I am using an Ajax command to query data from a local server and I need to return a JSON object via the success handler.
My Ajax command looks like this:
var json = $.ajax({
url: 'http://localhost:9200/wcs/routes/_search',
type: 'POST',
data: JSON.stringify({
"query": {
"match_all": {}
}
}),
dataType: 'json',
async: false
});
I'd like to return the JSON document in the variable that I already have assigned: json
Could I do something like this in the command? (I know this isn't correct code):
success: return(json);
});