JQuery ajax and php die ()
I have a problem with IE. I am using jquery ajax method to call php script. The PHP script just calls die (). In firefox, it shows an error message, but in IE, it shows the success message without any data. I would rather call the error function.
Is there a way to fix this? I am guessing my javascript code needs to be changed somehow.
Thanks!
<?php
die()
?>
$.ajax({
url: "phps/php.php?id="+the_id,
dataType: "json",
error: function(){
alert('error');
},
success: function(data){
alert("SUCCESS");
}
});
a source to share
error (XMLHttpRequest, textStatus, errorThrown)
Function to be called if the request fails. The function has three arguments: An XMLHttpRequest object, a string describing the type of error that occurred and the optional exception object if it occurred. Possible values ββfor the second argument (other than zero) are timeout, error, notmodified, and parsererror.
success (data, textStatus, XMLHttpRequest)
. Function if the request is completed successfully. the function takes three arguments: Data returned from the server, formatted according to the 'dataType' parameter; a line describing the state of affairs; and an XMLHttpRequest object (available in jQuery 1.4).
ajax()
and a combination of php. try reading this .
a source to share