In a PHP code block, yes. And with error checking via isset() if your server requires that. Most are not that strict.
To diagnose the javascript part of it, I would need a link to the live page. However, even at that it would be time consuming to mock up because of the AJAX involved. To fix up the PHP part, I would need to see all of the PHP code employed.
And I only have a vague idea of you objective here. It would help if you could be more clear on that.
You might not need so much code. I get the feeling that you might be over complicating things. Like if you want to use AJAX, let it do most of the work and use less PHP and normal HTML. Or perhaps consider doing it all via PHP.
One thing I did say is that if the link doesn't fire (often the case where javascript is involved), it won't matter if the query string is valid or not, at least insofar as what would normally happen in PHP and HTML on the page.
This from my earlier post however does work:
and answers your original question.Quote:
PHP Code:<?php
if(isset($_GET['bob'])){
echo $_GET['bob'];
}
?>
<a href="?bob=Fred's Friend#/work/page1">GoTo /work/page1</a>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<a name="/work/page1">/work/page1</a>
I might add that if the javascript code relied upon an invalid query string in order to parse the link, of course it will no longer work if you change it to a valid one.
Another thing I didn't mention before because it's unclear to me what your $.ajax() function is doing is that it appears perhaps to be a POST request. If so, the query string (GET data), even if valid (perhaps especially if valid), might not get passed to the requested page.

