I\'m sure you know this problem, I\'m still trying to solve it for few days. I\'ve tried lots of stuff but no one worked:
Here is the code
function l
Correctly stated that you can't really return from the Success, however, if you are doing what I think you are doing, and that is to grab the data and return it and assign it to something in another area IE
var obj = lobbyLeader();
Then you can just set the function to async:false and return the obj outside of the Success after the code has finished running. example
function lobbyLeader() {
var obj;
$.ajax({
async:false;
data: {"id": 1, "request": "lobbyinfo", "method": "read"},
url: 'api.php',
dataType: 'json',
success: function(data){
obj= JSON.parse(data);
}
});
return obj;
}
This way the script stops to wait for success and then sets and returns.