beantownace
Active member
- Joined
- Feb 15, 2019
- Messages
- 42
- Programming Experience
- 5-10
I am trying to do the following function and I need to make sure I don't pass back the pass variable until it is done and I can't run this as async: false how can I do this without making it sync?
JavaScript:
function checkResult(id) {
var pass = false;
$.ajax({
url: myurl
contentType: "application/html; charset=utf-8",
data: { id: id },
type: "GET",
dataType: "json",
success: (function(result) {
pass = result;
}),
error: (function(result) {
pass = result;
})
});
return pass;
}
Last edited by a moderator: