I'm coding a website where I use SWFUpload and a lot of Ajax $('#maincontent').load(URL) to replace the content of the main view.
Unfortunately, in IE 7+, when I have an SWFUpload instance in an element from #maincontent and I use .load() to replace the content of #maincontent, I get an infinite loop of errors from SWFUpload that is looking for it's DOM Element (that was removed). (Namely : "unable to set value of the property 'SetFileQueueLimit' : object is null or undefined", "unable to set value of the property 'SetHttpSuccess' : object is null or undefined" indefinitely).
Of course, this more or less blocks the javascript engine and leaves a non-responsive page where no javascript gets fired.
So my question is : how can I bind the Ajax load() of #maincontent so I can do uploader.destroy on my element before it gets removed ?
(Or any other suggestion to fix the IE problem…)
Thanks !
According to the doc of jquery, the call back of the method load is executed after the content has been changed. So you might prefer using
$.get(URL, function(data) {
uploader.destroy();
$('#mainContent').html(data);
});