I just installed LAMP. Everything seems to be working fine except when I send data from js to php via ajax, php does not receive the data sent. I suspect this has to do with a setting in php.ini but I don’t know which to change. My js ajax function looks like this:
function ajax (url, data_to_be_sent, callback_func) {
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=callback_func;
xmlhttp.open("POST",url,true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send(data_to_be_sent);
}
Two things you need to do:
Debug your client side Javascript to verify you’re making the right call, with the right URL string.
Look at your server side logs to see if any client-side requests are being made, and if there are any errors.
This really has nothing to do with PHP, and messing with php.ini isn’t going to help.
PS:
You’re using something like Firebug, aren’t you?