【问题标题】:jQuery serialize with Ajax does not work in IE9使用 Ajax 进行 jQuery 序列化在 IE9 中不起作用
【发布时间】:2011-07-16 06:23:12
【问题描述】:
function myTimestamp(){  
    tstmp = new Date();      
    return tstmp.getTime(); 
}   
function showValues() {  
    var str = ($("#this").serialize());  
    $("#results").text(str);  
}  
$(":checkbox, :radio").click(showValues);  
$("select").change(showValues);  
showValues();  
function sendValues() {  
    var str = $("#this").serialize();  
    var response = $('input[name=product[]]:checked').val();  
    $.ajax({  
        url: "/post.php?avoidcache=' + myTimestamp();",  
        data: {str}  
        cache: false  
    });  
}

此脚本在 Google Chrome 中运行良好;但是,在 IE 中使用时,它只会执行选定元素之一:其余选定元素会被截断。 有什么建议吗?

【问题讨论】:

  • 我刚刚找到答案
  • 然后输入下面的答案并检查;)...或请求关闭问题。
  • 与此代码关联的 HTML 是什么? (具体#this
  • 这个错误是否也适用于 Firefox 4.0?我认为是的。

标签: jquery ajax internet-explorer-9


【解决方案1】:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

【讨论】:

  • 我建议不要使用它,因为它会强制所有版本的 IE 进入 IE7 模式,这会破坏 CSS 和盒子模型。
猜你喜欢
  • 1970-01-01
  • 2013-06-22
  • 2015-01-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多