House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home / Groups / ColdFusion Talk (CF-Talk)

Anyone see anything wrong with this code?

Author:
Brian Thornton
05/01/2012 02:07 PM

You are refrencing as 1 and need to refrence as the index. > > Looks like a good solution for getting some error clues > back from AJAX calls. I'll have to work on translating > this into jQuery. Usually, I can find some CF error code > in the iFrame used to process the file uploads, but nothing > is appearing there, or in the JSON reply. > > Thanks for the tip! > > Rick > > [mailto:=?ISO-8859-1?Q?Claude_Schn=E9egans <schneegans@interneti=71?= > =?ISO-8859-1?Q?ue.com=3E?=] > Sent: Tuesday, May 01, 2012 1:13 PM > To: cf-talk > Subject: Re: Anyone see anything wrong with this code? > > > »>>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() >     } > > > > >


Search cf-talk

May 18, 2013

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Designer, Developer and mobile workflow conference