I'm trying to return a list of select options to a JqGrid Add feature. I have a javascript/jquery function that does a GET to get a string preformatted to work with JqGrid. I'm having trouble returning the results to the JqGrid though. How do I return the data from the jQuery Get function?
function getDealerPoolSelectOptions() {
var selectOptions = "1:A;";
$.get("DealerManagement/GetAllDealerPoolCodes", function(data) {
alert("Data: " + data.toString()); //Displays all the data I'm looking for
selectOptions = data;
});
alert("SelectOptions: " + selectOptions); //Just Displays the 1:A
return selectOptions;
}
selectOptions = data.toString()?$.getis asynchronous, so selectOptions is getting set after the return of the function (the code inside runs after the request returns from the server)alert("SelectOptions: " + selectOptions);inside of thefunction(data) {...}?=>desk