is it possible to pass a search term into the ajax search, instead of hardcoding the query? I’ve been messing around with object literals or some form of associative array but none have worked.
Below is what I’m going for with “Search object” being the object to pass into the query:
acTest = $.ajax(**searchObject**{
url: "http://dev.virtualearth.net/REST/v1/Locations",
dataType: "jsonp",
data: {
key: UserConfig.bingMapsKey,
q:**SearchObject**
},
jsonp: "jsonp",
success: function (data) {
var result = data.resourceSets[0];
if (result) {
if (result.estimatedTotal > 0) {
response ($.map(result.resources, function (item) {
return {
data: item,
label: item.name + '(' item.address.countryRegion + ')',
value: item.name
}
}));
}
}
}
});
Absolutely, simply pass in a variable