I just solved a nasty bug on my end and thought others might benefit
from my pain.

Our form code handle lots of different types of data.  And forms can
be loaded individually via AJAX.  I recently started converting all of
this code to jquery.ajaxForm.

When ajaxForm submits a form that has a file, it opens an iframe,
copies your filled-in form to the iframe, submits the form *in the
iframe*, then copies the response back to you.  Very nice.

Unfortunately, if your code doesn't return fully valid HTML, the
iframe handler on IE doesn't format your return value well and (as
happened to us), the initial FORM tag gets put in to the HEAD.  Ugh.

Our solution was to add an extra parameter (using ajaxForm's
undocumented extraData option) indicating this would be an iframe.
Then, on the server-side, if we see this parameter, we wrap the whole
sucker to make it a valid page.

Of course, perhaps there was a better way to handle this?  Anyone else
have ideas?

_jason

Reply via email to