I am working with .load function in jqueryjQuery to load a html page into a div with ajax but I have problem since server always doesn't send a html, sometimes it send a json and I want to get that josnjson with .load.
I thought it would be a response in callback function in .load but it return undefined and just put that json into the div so how can I get that josnjson with .load.
the
The server send this json :
{ok : false}
Here is my jqueyjQuery code:
$( "#div").load( "url", function( response, status, xhr ) {
////how can I get the false result here response.ok return nothing!!!
console.log(response.ok);
if ( status == "error" ) {
var msg = "Sorry but there was an error: ";
$( "#div" ).html( msg + xhr.status + " " + xhr.statusText );
}
});