It is interesting to note here that iframes have a history. If I recall correctly:
Originally, iframes were an IE only gambit and served to sidestep the more routinely employed numbingly complex of framesets, divs, layers and ilayers. Then iframes were a security issue. Today iframes are a very handy vehicle allowing fast integration of disparate content items/sources. Like Jeff Goldblum as Dr. Ian Malcolm says -- I think maybe in Jurassic Park X, and correct me if I am wrong, but he says: "Nature will find a way. Nature always finds a way." Peter -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of csnyder Sent: Wednesday, February 28, 2007 3:11 PM To: NYPHP Talk Subject: Re: [nyphp-talk] Thoughts on using JavaScript with no progressivefall-back On 2/26/07, Chris Shiflett <[EMAIL PROTECTED]> wrote: > What's the best-of-breed solution for changing a regular form submission > button to initiate an Ajax call instead of submitting the form? I've got > a hacky solution that involves rewriting the button, adding an > onsubmit() action, and trying to keep it from submitting the form in IE, > but it feels like there must be a more elegant solution. > That's why I used the word "mojo" -- it's not the name of a new framework, it's a description of the approach. Or as you say, hacky. I leave form buttons intact, and just change the form's target attribute to submit to a hidden iframe. I prefer that method since it allows file upload, whereas XMLHttpRequest form submission does not. Getting the response out of the iframe is also hacky, but iframes generate an onload event. The code to actually get the content out is platform dependent: function iframeonload() { var ifdoc = $("hiddenIFrame").contentDocument || document.frames("hiddenIFrame").document; // etc... } What you _don't_ get with iframes is any sort of intelligent HTTP error handling. -- Chris Snyder http://chxo.com/ _______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php _______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php