Speaking of errors... That's one thing I've really wanted. When using jQuery, I've noticed that assuming all of the syntax is valid, if you run code that doesn't work, nothing happens. No error message, nothing.
That makes debugging quite difficult because you have no idea where to start. Is there any way that jQuery could generate SOME sort of error, a default alert box maybe) with error information? <!----------------//------ andy matthews web developer certified advanced coldfusion programmer ICGLink, Inc. [EMAIL PROTECTED] 615.370.1530 x737 --------------//---------> -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of John Resig Sent: Wednesday, August 16, 2006 11:28 PM To: jQuery Discussion. Subject: Re: [jQuery] Improvements in Ajax facilities This is an amazing set of fixes/updates. I poured through them, made some tweaks, changes, and bug fixes and committed it to SVN. The big change, from your code, is that 'failure' is now 'error' - to be consistent with the current naming scheme. Keep up the great work! --John On 8/16/06, Taku Sano (Mikage Sawatari) <[EMAIL PROTECTED]> wrote: > With Ajax facilities of jQuery, it is not easy to deal with errors. In > addition, it is inconvenient to repeat reloading the same URL to > observe changes. Please confirm my patch handles these issues. > > [patch for svn.208] > http://pepper.sherry.jp/jquery/newajaxpatch-svn208.patch > > [test page] > http://pepper.sherry.jp/jquery/newajaxfunc.html > > Problems: > - $().load() replaces the HTML regardless of whether the request has > succeeded or failed. Therefore it is impossible to customize an error > message to show. > - Callback functions can't learn if the request has succeeded or not. > - It's true that there are methods that are called on error. But even > if it failed, DOM elements are always replaced, and callbacks are > always called. > - There are no ways to set timeout. In case of a server doesn't respond, > we can't abort the request after a few seconds and display an error. > > Improvements: > - Callbacks for $().load(), $.get, $.post now takes the second argument > which represents a state ("success", "failure", "notmodified"). > - $().load() no longer replaces the HTML on error, if a callback is > supplied. Without a callback, it replaces the HTML on error as it > used to do. > - $().load(), $.get, $.post now can timeout. When it timed out, the state > becomes "failure" and treated as an error. > $.ajaxTimeout(1000); // ms > $().load(); > - Added 2 ajax methods: > $().loadIfModified(); > $.getIfModified(); > These methods set If-Modified-Since header to Ajax requests. They are > useful when we periodically reload the same URL to see changes. > > They work the same way as $().load and $.get if the URL is updated. > When it is unchanged, ().load doesn't replace the URL but does callback. > In that case, the state will be "notmodified". > > Since IE always returns the same cached content for the same URL, it is > normally impossible to check changes. It's true that it is possible to > force not to use cache by appending some random characters as query of > the URL, but then we waste the traffic needlessly. $().loadIfModified() > and $.getIfModified() solve this problem. > > > ---- > Taku Sano > > _______________________________________________ > jQuery mailing list > [email protected] > http://jquery.com/discuss/ > -- John Resig http://ejohn.org/ [EMAIL PROTECTED] _______________________________________________ jQuery mailing list [email protected] http://jquery.com/discuss/ _______________________________________________ jQuery mailing list [email protected] http://jquery.com/discuss/
