function lookupRemote(searchTerm)
{
var defaultReturnValue = 1010;
var returnValue = defaultReturnValue;
$.getJSON(remote, function(data)
{
if (data != null)
{
$.each(data.items, function(i, item)
{
returnValue = item.libraryOfCongressNumber;
});
}
});
return returnValue;
}
इस फ़ंक्शन से returnValue
फ़ंक्शन की शुरुआत में डिफ़ॉल्ट मान सेट के बराबर क्यों है और कभी भी JSON लुकअप से पुनर्प्राप्त मूल्य के बराबर नहीं है?
देखें http://stackoverflow.com/questions/3537434/cant-get-correct-return-value-from-an-jquery-ajax-call –
संभावित डुप्लिकेट [AJAX कॉल से प्रतिक्रिया कैसे वापस करें? ] (http://stackoverflow.com/questions/14220321/how-to-return-the-response-from-an-ajax-call) – Bergi