I have a JavaScript class that has a method:
function someClass() {
this.someMethod = someClass_someMethod;
}
function someClass_someMethod() {
// make an AJAX request
}
The problem is that someClass_someMethod()
needs to return the value of the AJAX request.
I'm using jQuery's $.getJSON()
method to fetch the data. The data needs to be returned but it seems the only way to get the data is through a callback.
How can this be done?