This question has already been answered:
Hello.
Faced a small puzzler. Tell me, please, how to return the value to the function? Here is a sample code:
var searchSku = function(val){ var path = "/search.json?q=", sku = val; jQuery.ajax({ url: path + val, type: 'get', dataType: 'json', success: function($data) { var b = $data.id; //тут мы получаем значение }, }); // как вернуть это значение? return };