【发布时间】:2012-09-12 15:07:36
【问题描述】:
阅读帖子 4 小时后试图解决这个问题.....
我使用插件上传照片并将其返回到 Tinymce 编辑器。它在 Chrome 和 Firefox 中完美运行,但在 IE 中失败。在开发工具中,它在第 474 行的 jquery.forms.js 中中断,因为 IE 无法识别 finally 语句。所以我删除它,然后当同一个文件调用form.submit() 时,我收到拒绝访问。无论如何我都无法解决这个问题。我正在使用Jquery v. 1.8.1 和Malsup 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);
}
}
任何帮助,你都会拯救我的理智,谢谢!
【问题讨论】:
标签: jquery ajax internet-explorer plugins jquery-forms-plugin