function lookupRemote(searchTerm) { var defaultReturnValue = 1010; var returnValue = defaultReturnValue; $.getJSON(remote, function(data) { if (da
If you don't want to use asynchronous function, better use the following:
function getValue(){ var value= $.ajax({ url: 'http://www.abc.com', async: false }).responseText; return value; }
This function waits until the value is returned from the server.