What's the best way to debug AJAX to PHP calls?
Posted
by Jascha
on Stack Overflow
See other posts from Stack Overflow
or by Jascha
Published on 2010-05-17T23:46:04Z
Indexed on
2010/05/17
23:50 UTC
Read the original article
Hit count: 184
I'm having a miserable time debugging one small function on my new project.
Essentially I'm having a user log out via an AJAX call to my log out script on my server called "userfFunctions.php" I'm using AJAX so that I don't have the headache of writing more regex to match my mod_rewrites. Anyway, every so often, it seems as though my Post data just flat out dies and since the PHP is running behind the scenes, I feel like I have no way of finding out where the data flow is being disrupted. BTW This function works 19 hrs of the day.
Here is the javascript function:
function logOut(){
var data = new Object;
data.log_out = true;
$.ajax({
type: 'POST',
url: 'http://www.mydomain.com/User_Validator', //<-- redirects to userFunctions.php
data: data,
success: function(data) {
alert(data); // <-- a response is triggered but with no response data!
}
});
}
the php side:
if(isset($_POST['log_out'])){
echo 'alert this!';
}
here is my awesome response:
© Stack Overflow or respective owner