I seem to be encountering a situation where multiple asynchronous ajax call are causing cfwheels to return an action not found error. I noticed when I add async:false to my ajax call I get a successful response but when I don't add that I randomly get an error response.
This code works fine when other ajax calls are being processed but it takes longer to load due to the async setting.
var checkLogin = function(){
var loggedin = false;
loginValidated = true;
//Check login status
$.ajax({
type: "POST",
url: '/loginAjax/validateLogin?format=json',
global: false,
async: false,
success: function(data) {
if (data.loggedIn) {
loggedin = true;
}
}
});
return loggedin;
};
This fails randomly, notice I removed the async setting:
var checkLogin = function(){
var loggedin = false;
loginValidated = true;
$.ajax({
type: "POST",
url: '/loginAjax/validateLogin?format=json',
global: false,
success: function(data) {
if (data.loggedIn) {
loggedin = true;
}
}
});
return loggedin;
};
Here is the action I am calling:
<cffunction name="validateLogin">
<cfset var returnObj = {}>
<!--- Set Return Data --->
<cfset returnObj["loggedIn"] = false>
<cfif StructKeyExists(SESSION.User, 'loggedIn')>
<cfset returnObj["loggedIn"] = true>
</cfif>
<cfset renderWith(returnObj)>
</cffunction>
Any help is appreciated. :)