Skip to content

IE7 and iframeTarget fixes #258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.settings
/.project
20 changes: 11 additions & 9 deletions jquery.form.js
Original file line number Diff line number Diff line change
@@ -315,15 +315,15 @@ $.fn.ajaxSubmit = function(options) {
s.context = s.context || s;
id = 'jqFormIO' + (new Date().getTime());
if (s.iframeTarget) {
$io = $(s.iframeTarget);
$io = $(s.iframeTarget, form.ownerDocument);
n = $io.attr('name');
if (!n)
$io.attr('name', id);
else
id = n;
}
else {
$io = $('<iframe name="' + id + '" src="'+ s.iframeSrc +'" />');
$io = $('<iframe name="' + id + '" src="'+ s.iframeSrc +'" />', form.ownerDocument);
$io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
}
io = $io[0];
@@ -465,11 +465,11 @@ $.fn.ajaxSubmit = function(options) {
// if using the $.param format that allows for multiple values with the same name
if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {
extraInputs.push(
$('<input type="hidden" name="'+s.extraData[n].name+'">').attr('value',s.extraData[n].value)
$('<input type="hidden" name="'+s.extraData[n].name+'">', form.ownerDocument).attr('value',s.extraData[n].value)
.appendTo(form)[0]);
} else {
extraInputs.push(
$('<input type="hidden" name="'+n+'">').attr('value',s.extraData[n])
$('<input type="hidden" name="'+n+'">', form.ownerDocument).attr('value',s.extraData[n])
.appendTo(form)[0]);
}
}
@@ -478,12 +478,14 @@ $.fn.ajaxSubmit = function(options) {

if (!s.iframeTarget) {
// add iframe to doc and submit the form
$io.appendTo('body');
if (io.attachEvent)
io.attachEvent('onload', cb);
else
io.addEventListener('load', cb, false);
$io.appendTo($form.closest('body'));
}

if (io.attachEvent)
io.attachEvent('onload', cb);
else
io.addEventListener('load', cb, false);

setTimeout(checkState,15);
form.submit();
}