I am a relatively newbie at this, but here is a suggested work around I came up with which eliminates the need to set asynch
to false or anything like that. Just set a hidden field value with the result of the ajax call, and instead of checking return value, check the value of the hidden field for true/false (or whatever you want to put in it).
Example:
function doSomething() {
$.ajax({
...blah blah
},
success: function(results) {
if(results === 'true') {
$('#hidField').val('true');
}
else {
$('#hidField').val('false');
}
}
});
Then somewhere else where it's required, this doSomething
function is called, and instead of checking the result of the ajax call, look for the hidden field value:
doSomething();
var theResult = $('#hidField').val();
if (theResult == 'true') {
...do whatever...
}