Sever Request Not Working!
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   justin_s
Posted On:   Monday, April 23, 2007 04:11 PM

i am trying to use ajax to send a request to the page that it's on, and have it return text. i simply want a link that you click and it will ask the page using GET, page.php?test1=asd, and then for a div to display "asd", or whatever the php outputs. I followed several tutorials and cannot seem to find the answer! i would greatly appreciate your help. here is what i have so far: JAVASCRIPT/AJAX CODE: } ]]> HTML CODE: testd test PHP CODE: <?php if($_GET['test1']) { //echo "test1a"; return "tes   More>>

i am trying to use ajax to send a request to the page that it's on, and have it return text.



i simply want a link that you click and it will ask the page using GET, page.php?test1=asd, and then for a div to display "asd", or whatever the php outputs.



I followed several tutorials and cannot seem to find the answer! i would greatly appreciate your help.



here is what i have so far:



JAVASCRIPT/AJAX CODE:

			
}
]]>





HTML CODE:
			
testd

test




PHP CODE:
			
<?php
if($_GET['test1']) {
//echo "test1a";
return "test1b";
}
?>



Help would be appreciated!    <<Less

Re: Sever Request Not Working!

Posted By:   Robert_Lybarger  
Posted On:   Monday, April 23, 2007 08:13 PM

Your first javascript statement looks wrong. Check your browser's javascript/error console and it'll probably flag that line. I suspect it should be more like:
var req = new XMLHttpRequest();

Of course you know that code probably won't work under an MSIE-based browser, as you need to fetch a reference to an activeX control instead, right?
About | Sitemap | Contact