I'm stumped here. I've got Ajax code working fine with the POST method in other parts of my website, but not working on this page for some reason. Yet when I use GET, it works fine.
For troubleshooting, I'm just dumping the POST and GET arrays:
echo "POST: ";
var_dump($_POST);
echo "\n\nGET:";
var_dump($_GET);
die();
The GET method below alerts me with the correct dump GET array variables. But if I try to use the POST method (commented out below), both arrays come up empty.
// Process AJAX...
function postResult(url, vars)
{
// Initialize AJAX...
ajaxObj = getObj();
// Set up request...
ajaxObj.open('get', url + '?' + vars, true);
// ajaxObj.open('post', url, true);
// Process...
ajaxObj.onreadystatechange = function doThis()
{
if(ajaxObj.readyState == 4 || ajaxObj.readyState == 'complete')
{
alert(ajaxObj.responseText);
}
}
// Send request...
ajaxObj.send(null);
// ajaxObj.send(vars);
}
The most puzzling thing is that Firebug indicates that the POST variable is correct:
"Post: wid=1190&txt=xxx12"
Any clues?