Jquery form plugin not working in IE 8
Asked Answered
L

1

8

After 4 hours of reading posts to try to solve this.....

I use the plugin to upload photos and return it to the Tinymce Editor. It works perfect in Chrome and Firefox but fails in IE. In the dev tools, it breaks in jquery.forms.js on line 474 as IE wont recognize the finally statement. So I remove it and then I receive access denied when the same file calls form.submit(). No matter what I can't sove this issue. I'm using Jquery v. 1.8.1 and Malsup Jquery Form Plugin v. 3.15.

Here is the code:

$("#img-form").hide(); // hide the browse button

$("#image").change(function() {
    $("#img-form").ajaxSubmit(options); // upload the file directly after selection
});


/*
 * set options for jQuery form plugin
 */
var options = { 
    cache: false,
    contentType:"text/html",
    type: 'POST',
    url: "../upload.php",
    data: { width: w, height: h, bounds: b },
    success: showResponse  // post-submit callback 
}; 

function showResponse(responseText, statusText, xhr, $form)  { 
    var obj = JSON.parse(responseText);
    var state = obj.state;
    var response = obj.response;

    if(state) {
        tinyMCE.execCommand('mceInsertContent', false, response); // place the image into the editor
    } else {
        alert(response);
    }
} 

Any help at all and you will save my sanity, thanks!

Litch answered 12/9, 2012 at 15:7 Comment(0)
L
6

It turns out this is 100% not possible. Since I opened the file browser via a triggered click and not by an actual user clicking the button, IE will no way no how allow you to submit a form for security reasons. I had to have the user click the file input manually and then the form plugin did it's magic.

Litch answered 20/9, 2012 at 20:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.