PORK.iframe

WTF is PORK.Iframe?

PORK.Iframe is a really easy way to submit your forms without reloading the page, in just one line of Javascript like you're used from the popular 'AJAX' frameworks. PORK.Iframe was built from moo.ajax which was altered to to hook your form's onSubmit event, dynamically create a hidden <iframe> tag, set your form's target to that hidden iframe, and then fire an event as soon as the response got back. The main advantage is that you can just create the forms you were always used to create, and the same response HTML you were always used to create, but now you can just update the contents of one (or more, using built-in JSON support) DIV's :-)

In what browsers does that work?

Just about any decent an browser now supports Pork.Iframe. It's is now confirmed working on : IE5, IE5.5, IE6, NS6, Firefox, Opera and Safari!

What's that JSON stuff?

from JSON.org: JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 1999. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language. In short, JSON is used to create an array of DIV's to update. This array is then walked, and the innerHTML of any element that matches the array key is updated with the corresponding array value.

Ok.. Sounds cool. Got any examples?

Sure just, go here for some Pork.Iframe Examples.

Yum! Can i download?

Go here to download Pork.Iframe, Pork.Iframe lite or my super simple PHP5 JSON Class.

Reply