I use ajax()
and the result I got is a list of object array. When user pass invalid param, instead of the server side give me an invalid message it gave me fatal error (PHP). I have no control over the PHP, how should I catch if there's invalid respond?
I can't do respond == 'undefined'
.
I think you are using $.ajax() of jQuery?
$.ajax({
url: 'myphpfile.php',
type: 'get',
datatype: 'json',
success: function(data) {
alert('No PHP file error');
}
// now with error handling
,error {
alert('PHP file error');
}
});