I have the following ajax call in a function, which is called upon a clickevent.
$.ajax({
url:"server.php",
type:'GET',
data: {'action':'addEvent'},
success: function(response)
{
if(response)
{
alert("200 ok");
}
},
error: function(xhr, ajaxOptions, ThrownError)
{
alert("Error:" + ThrownError);
$("#output").text("Error: "+ThrownError);
}
});
The php side is as follows.
if(isset($_GET["action"]))
{
$action = $_GET["action"];
if($action == 'addEvent')
{
echo("ping");
}
}
Now it throws an error. But the error message i get is :
Exactly, i get Error:
It is driving me crazy.
Also i put in my document.ready, to let it act as some sort of ping, and it worked perfectly