I have a standard ajax call from jquery as below.
I would like to check if the json array returned is requesting a new page, and if yes, go there and do not execute the .always callback.
Is there a simple way to do this?
var jqxhr = $.ajax({ url: server_URL + '/index.php', type: 'post', dataType: "json", data: obj }).done(function (data) { if (data['go_location']) { window.location.href = data['go_location']; } else { //other stuff } }).fail(function () { alert("ajax error"); }).always(function () { //other code });
always?30XHTTP code? or that the JSON has ago_locationvariable?