I\'m trying to use jQuery to call some custom API via Ajax/$.getJSON.
I\'m trying to pass a custom value into the Ajax callback method, but that value
You don't need to pass it in, just reference the variable you already have, like this:
var locationType = 3;
var url = 'blah blah blah' + '&locationType=' + locationType;
$("#loading_status").show();
$.getJSON(url, null, function(results) {
searchResults(results, locationType)
});
Also there's no need to pass null if you don't have a data object, it's an optional parameter and jQuery checks if the second param is a function or not, so you can just do this:
$.getJSON(url, function(results) {
searchResults(results, locationType)
});