My code is:
var test = \"it isn\'t working\";
var response = $.ajax({
type: \'GET\',
url: \'jquerydemo.php\', //This is in the same site as the page
Move that alert(test) from end into the success function of the ajax call. If it alerts it means code is working else it is not. you can only debug ajax call on its success return.
var test = "it isn't working";
var response = $.ajax({
type: 'GET',
url: 'jquerydemo.php',
success: function(){
test = "it's working";
alert(test); //It will alert when you ajax call returns successfully.
},
error: function(){
alert("Error detected");
}
}).responseText;
Hope this helps.