简体   繁体   English

ajaxSubmit和Internet Explorer问题

[英]ajaxSubmit and Internet explorer issue

I'm stuck for quite some time with this, could someone help me out ? 我为此困扰了很长时间,有人可以帮我吗? Everything is working fine with Chrome and FF, but for some reason the form won't submit with IE7/IE8/IE9. Chrome和FF一切正常,但由于某种原因,该表单无法与IE7 / IE8 / IE9一起提交。

function addFile()
{
if ( test > 30 ) { console.log( "addFile" ) ; }

var optionsAjaxFormFile = { 
    url : 'js/fileUpload.php',
    success : showResponseFile
}; 

console.log("about to submit Ajax");
$("#addFile-form").ajaxSubmit( optionsAjaxFormFile );   
}

I know from the Console it goes to the ajaxSubmit line, but it never starts the showResponseFile function. 我从控制台知道它进入了ajaxSubmit行,但是它从未启动showResponseFile函数。 Why ??? 为什么???

Cheers 干杯

Not sure but you can try with this: 不确定,但是您可以尝试以下操作:

$(document).ready(function() { 
   $("#addFile-form").submit(function(){
      $(this).ajaxSubmit(optionsAjaxFormFile);
      return false; 
   });
});

console is only defined in IE9 when its DOM inspector is open, replace console.log() with 仅当IE9的DOM检查器打开时,才在IE9中定义console,将console.log()替换为

if(typeof(console)!='undefined'){
 console.log("about to submit Ajax");
}

or you can use the good old alert 或者您可以使用良好的旧警报

In between the head tag add 在head标签之间添加

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" >

you will also need to close and open IE again for the meta tag to work 您还需要关闭并再次打开IE才能使meta标签起作用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM