ajaxSubmit and Internet explorer issue

三世轮回 提交于 2019-12-11 03:06:00

问题


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.

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. Why ???

Cheers


回答1:


Not sure but you can try with this:

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



回答2:


console is only defined in IE9 when its DOM inspector is open, replace console.log() with

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

or you can use the good old alert




回答3:


In between the head tag add

<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



来源:https://stackoverflow.com/questions/15425231/ajaxsubmit-and-internet-explorer-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!