Im trying to get a function returned value out from it.
function startFilter(callback) {
$.getJSON('services/hoteljson.php', callback);
}
var data = startFilter(function(json) {
json= jQuery.grep(json, function(element, index){
var productNameSearch = new RegExp('Hot' , "gi");
return element.prodname.match(productNameSearch);
});
return json;
});
I've tired few options but nothing seems to be wokring
i wanted to use data
anywhere i wish.
what will be the best method to do so?
Review:
The duplicate question doesn't give the answer what i seek, just some showoff stuff.