I am trying to create a jQuery plugin that will clone a form to an iframe then submit a form. It is a hack to fake an ajax file upload. I also know there are plugins like this already, but none that I have trie meet my needs. I have a problem appending a jQuery object to anything in IE. (I am running IE 7.0) I have tried FF and it works perfectly. I am also using jQuery 1.3.2 min. Any help would be greatly appreciated.
(function($){
$.fn.extend({
//pass the options variable to the function
formUploader: function(options) {
//Set the default values, use comma to separate the settings, example:
var defaults = {
onSubmit: function(){ return true;},
onComplete: function(){ return true;}
}
var settings = $.extend(defaults, options);
return this.each(function() {
$(this).submit(function(){
var id = "asdfasda";
$(document).find('body').append('<iframe src="javascript:false;" name="' + id + '" id="' + id + '" />');
//this should be a form
var curEl = this;
setTimeout(function()
{
//fails in IE but not in FF
$("#"+id).contents().find("body").append($(curEl).clone());
},250);
return false;
});
});
}
});
})(jQuery);