Is there a way to wait for jQuery's getJSON method?
I want to parse the data, recieved with this function and just return false/true if a specific string is contained. But due to the asynchronous data processing this seems not to be that easy. Here is a code snippet:
contained = false;
$.getJSON(URL, function ( data ) {
$.each( data, function( i, item ) {
if ( item.Info.code == code ) contained = true;
});
});
After thid code, the function, where this code is placed in, returns the 'contained' value, whis is basically false, because getJSON has not finished yet.