This test application demonstrates a number of features:
- The ability to create and manipulate elements within an iframe.
- The ability to load a javascript file(s) inside an iframe
- The ability for iframes to have their own instance of xajax
- The ability for an iframe to communicate back to the parent
- The response command waitFor... which can wait for a custom condition to evaluate to true.
When you click the submit button, it will send a xajax request which in turn triggers the following:
The form values are displayed in the iframe and the main document.
The iframe is instructed to load a javascript file (iframe.js)
The main document frame waits until the javascript file is fully loaded (using waitFor)
The iframe.js invokes a xajax request (in the iframe to theFrame.php) which sleeps for 2 seconds, then returns 'iframe.js loaded'.
The iframe.js waits 4 seconds, then notifies the parent (main document) that the iframe.js file is fully loaded.
The main document displays that the iframe.js file is loaded in the iframe context.