jQuery AJAX call not exiting when there is no response data -
i have following jquery code:
$.ajax({ url: application.common.relativepath + '/persons/search/', contenttype: "application/json", datatype: 'json', // parameters name-value pairs passed data: { forename: forename, surname: surname, checkemployee: false }, success: function(data) { // no response data if (!data) { return; // problem. } // code executed if there response. } }); when there no response data, ajax function should exit, hence use of return statement. however, finding if there no response data (data null), code below gets executed means return statement not being called break out of jquery ajax call.
can please me break out of ajax call if there no data response.
an ajax call ends in success return data. if server has no data return, return empty object of datatype (in case json). you'll have check if json object contains data.
Comments
Post a Comment