Use Ajax Success Handler to return JSON object


New Member
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:\[code\]var json = $.ajax({ url: 'http://localhost:9200/wcs/routes/_search', type: 'POST', data: JSON.stringify({ "query": { "match_all": {} } }), dataType: 'json', async: false});\[/code\]I'd like to return the JSON document in the variable that I already have assigned: \[code\]json\[/code\]Could I do something like this in the command? (I know this isn't correct code):\[code\]success: return(json);});\[/code\]