opensubscriber
   Find in this group all groups
 
Unknown more information…

c : cf-talk@houseoffusion.com 2 May 2012 • 1:13AM -0400

Re: Anyone see anything wrong with this code?
by unknown

REPLY TO AUTHOR
 
REPLY TO GROUP





ยป>>I can't give any clues on error messages, because this
is part of a cfc on the back end of an ajax call.
No errors show up in firebug or elsewhere.

This is a problem with Ajax calls.
If the template called by Ajax throws an error, the text returned by the CF server is not compatible with Ajax and it causes an Ajax error. This error will not help, what one is intersted in is the error in the CF error.

I've developped my own Ajax call function, and in case of error, it will open a new window with the whole text returned in it. Generally, it is the error generated by CF.
This one is for POST method, but I have the equivalent for GET:
If there is anything wrong, the function calls displayError to displat the text actually received.

function ajaxPOST (url, sendText)
   {
   var XMLHttp = null;
     if (window.XMLHttpRequest)XMLHttp = new XMLHttpRequest();
     // code for MSIE
     else if (window.ActiveXObject)XMLHttp = new ActiveXObject("Microsoft.XMLHttp");
   if(XMLHttp)
     {
     XMLHttp.open("POST", url, false);
     XMLHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=iso-8859-1");
     XMLHttp.send(sendText);
     if (XMLHttp.status == 200)return XMLHttp.responseText;
     displayError("<H2>" + XMLHttp.statusText + "</H2><P>" + XMLHttp.responseText)
     return null;
     }
     else return null;
   }
function displayError(text)
     {
     var errorWin = open ("","Error","scrollbars=yes,resizable,width=900,height=600");
     errorWin.document.open();
     errorWin.document.write(text);
     errorWin.document.close();
   errorWin.focus()
     }


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350921
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.