在IE 8中Jquery表单插件无法正常工作

8

经过四个小时的阅读帖子尝试解决这个问题...

我使用插件上传照片并将其返回给Tinymce编辑器。它在Chrome和Firefox中完美工作,但在IE中失败。在开发工具中,它会在jquery.forms.js的474行中断,因为IE无法识别finally语句。所以我把它删除了,然后在同一文件调用form.submit()时收到了访问被拒绝的错误。无论如何我都无法解决这个问题。我正在使用Jquery v. 1.8.1Malsup Jquery Form Plugin v. 3.15

以下是代码:

$("#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);
    }
} 

任何帮助都可以拯救我的理智,谢谢!
1个回答

6

事实证明这是100%不可能的。因为我通过触发click打开了文件浏览器,而不是由实际用户点击按钮打开,IE出于安全原因绝对不会允许您提交表单。我必须让用户手动单击文件输入,然后表单插件才能生效。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接