Tutorial jQuery JSON getting with error catching
jQuery has a built in function called getJSON() to help making AJAX requests for JSON data easier. It normally works great, but if that func...
https://iskablogs.blogspot.com/2014/03/tutorial-jquery-json-getting-with-error.html
jQuery has a built in function called getJSON() to help making AJAX requests for JSON data easier. It normally works great, but if that function gets invalid data (or nothing) back, the callback function will not fire. If there is a legitimate risk of that, you can do this instead to catch for those errors.
$.get('/path/to/url', function (data) {
if( !data || data === ""){
// error
$.get('/path/to/url', function (data) {
if( !data || data === ""){
// error