Jquery表单插件在IE 8中不起作用

前端之家收集整理的这篇文章主要介绍了Jquery表单插件在IE 8中不起作用前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
经过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.

这是代码

  1. $("#img-form").hide(); // hide the browse button
  2.  
  3. $("#image").change(function() {
  4. $("#img-form").ajaxSubmit(options); // upload the file directly after selection
  5. });
  6.  
  7.  
  8. /*
  9. * set options for jQuery form plugin
  10. */
  11. var options = {
  12. cache: false,contentType:"text/html",type: 'POST',url: "../upload.PHP",data: { width: w,height: h,bounds: b },success: showResponse // post-submit callback
  13. };
  14.  
  15. function showResponse(responseText,statusText,xhr,$form) {
  16. var obj = JSON.parse(responseText);
  17. var state = obj.state;
  18. var response = obj.response;
  19.  
  20. if(state) {
  21. tinyMCE.execCommand('mceInsertContent',false,response); // place the image into the editor
  22. } else {
  23. alert(response);
  24. }
  25. }

任何帮助,你都会拯救我的理智,谢谢!

解决方法

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

猜你在找的jQuery相关文章