简体   繁体   English

jQuery POST方法在IE8上不起作用

[英]Jquery POST method doesn't work on IE8

My Jquery (version: 1.8.1) code: 我的Jquery(版本:1.8.1)代码:

$(document).ready(function() {  
    $('#Vehicle-make').change(function() {
        $.post(
            '/cakeMotors/ModelNames/viewList/' ,
            { make_id : $('#Vehicle-make').val() } ,
            function(data) {
                $('#Vehicle-model').html(data); 
            }   
        );
    });
});
  • Works fine on FF and Chrome, even checked that the server response to the POST request is 200. 在FF和Chrome上运行正常,甚至检查服务器对POST请求的响应为200。
  • #Vehicle-make and #Vehicle-model are both form selects. #Vehicle-make和#Vehicle-model都是形式选择。
  • It is not a cross-domain request, so I think that's not the problem. 这不是跨域请求,所以我认为这不是问题。
  • When I erase the $.post() and put something like an alert inside the .change event, it works fine! 当我擦除$ .post()并将类似警报的内容放入.change事件时,它工作正常! So, i guess IE is not messing with that either. 所以,我想IE也不会弄乱它。

What could it be? 会是什么呢?

IE is caching ajax urls. IE浏览器正在缓存ajax网址。 Try to put at the end of url parameter of time ticks (new Date).getTime() 尝试将时间刻度(新日期)的url参数放在末尾。getTime()

This will prevene IE to cache result. 这将防止IE缓存结果。

And yes, this is shot in the dark :) 是的,这是在黑暗中拍摄的:)

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

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