Posted: Mon Jan 29, 2007 9:40 pm
feyd | Please use
Except "bar.php" looks something like this:[/syntax]
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
The code you posted there is actually almost the identical way I'm doing it.
Except instead of attached ?xmlrequest as a get, I'm adding it as a POST.
So:
[syntax="javascript"]
function startRequest(){
...
var postText = 'variable=data';
postText += 'javascript=yes';
xmlHttp.open("POST","bar.php",true);
xmlHttp.send(postText);
}
Code: Select all
<?php
header('Cache-Control: none');
if($_POST['javascript']=='yes'){
header('Content-Type: text/xml');
}
// DO MYSQL STUFF
if($_POST['javascript']=='yes'){
echo "<results>";
echo "<content>" . $content_data . "</content>";
echo "</results>";
} else {
header('Location: originalPage.php?variable=' . $data);
}
?>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]