Here's my ajax function and my ShowResults function, which both work. The data from this ajax request is returned as a json array:
$.ajax({
url: "some URL",
type: "GET",
dataType: "json",
success: ShowResults,
error: function (jqXHR, textStatus, errorThrown) {
console.log("Not OK")
}
});
function ShowResults (data) {
$.each(data, function (item) {
$("#ResultSelector").append("<option value=>" + data[item] + "</option>");
});
}
});
From this I get a dynamic list of items displayed in a dropdown menu (with id 'ResultSelector'). I need to grab this same json data and use it in another function.
How do I define or extract this json data from the ajax call so that I can use it/refer to it in another function?
Thank you,