paddycobbett
asked on
What could cause an ajax request (using cfajaxproxy) to hang?
I'm having really inconsistent results with cfajaxproxy, whereby it seems to sometimes hang and ultimately crash the browser. Below is an example template function, so that you can see what the remote functions i'm writing look like, although this does work in 99% of the cases i have one instance inwhich it just hangs indefinately. It is completely bizarre since the log output just before "when it should return" is written out (and so the code block's contents are irrelevant), but yet the browser does not seem to recognise or i suspect receive an end-of-transmission message from the browser. The contents of the code-block does however influence whether or not the function returns, even tho the log outputs IN ALL CASES the final log message WITHOUT then returning!?
My question is has anyone found this hanging problem, i know it's not related to the code being executed hanging since the final log messages are outputed, and it's not due to an error being thrown within the code block since any error should be caught and returned as a message response. The javascript is alerting() all response text in all cases.
Has anyone seen this, and can anyone suggest any reason for this apparent hanging?
BTW. Using firebug it tells me that the javascript is not responding, or waiting for a response, and points me to inside the loop in figure b) in the attached code. Is this not indicating that it's waiting for a response from the server? .. any why does it not receive it??
This problem has been driving me nuts so any help much appreciated!
My question is has anyone found this hanging problem, i know it's not related to the code being executed hanging since the final log messages are outputed, and it's not due to an error being thrown within the code block since any error should be caught and returned as a message response. The javascript is alerting() all response text in all cases.
Has anyone seen this, and can anyone suggest any reason for this apparent hanging?
BTW. Using firebug it tells me that the javascript is not responding, or waiting for a response, and points me to inside the loop in figure b) in the attached code. Is this not indicating that it's waiting for a response from the server? .. any why does it not receive it??
This problem has been driving me nuts so any help much appreciated!
a)
<CFFUNCTION name="performThis" access="remote" returnFormat="plain">
<CFARGUMENT name="requestData" type="string">
// code here
<CFSET SESSION.log.debug("I am here")>
<CFRETURN "OK">
<CFCATCH type="any">
<CFSET SESSION.log.debug("Some error")>
<CFRETURN "Error-#cfcatch.message#">
</CFCATCH>
</CFTRY>
</CFFUNCTION>
b)
[CFIDE/scripts/ajax/package/cfajax.js -CF8]
$X.processResponse=function(req,_270){
var _271=true;
for(var i=0;i<req.responseText.length;i++){
var c=req.responseText.charAt(i);
_271=(c==" "||c=="\n"||c=="\t"||c=="\r");
if(!_271){
break;
}
}
... etc
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER