Internet explorer 在Internet Explorer中进行第二次调用后,jQuery ajax不工作

Internet explorer 在Internet Explorer中进行第二次调用后,jQuery ajax不工作,internet-explorer,jquery,caching,Internet Explorer,Jquery,Caching,我和其他很多人一样,也有一些问题,比如说缓存。我有一个拍卖网站,当用户点击出价时,触发此代码: function bid(id){ var end_dateUP=0; var tupdate=jq("#tupdate"+id).val(); if (tupdate=="lvl1"){ end_dateUP=20; }else if (tupdate=="lvl2"){ end_dateUP=15; }else if (tupdate=="lvl3"){ end

我和其他很多人一样,也有一些问题,比如说缓存。我有一个拍卖网站,当用户点击出价时,触发此代码:

function bid(id){
var end_dateUP=0;

var tupdate=jq("#tupdate"+id).val();

if (tupdate=="lvl1"){
    end_dateUP=20;  
}else if (tupdate=="lvl2"){
    end_dateUP=15;  
}else if (tupdate=="lvl3"){
    end_dateUP=10;  
}else{
    end_dateUP=0;
}

var url = "http://localhost/bid/comet/update-auction.php"; // the script where you handle the form input.
var user_id=<?php echo json_encode($user_id);?>; //here i'm getting id from SESSION
var user_name=<?php echo json_encode($user_name); ?>; //here i'm getting user name from SESSION
jq.ajax({
    type: "POST",
    async: false,
    url: url,
    data: {"auct_id" : id, "user_id" : user_id, "username" : user_name, "end_date" : end_dateUP}, // serializes the form's elements.
    cache:false,
    success: function(data)
    {
        setTimeout('waitForMsg()',100);
        jq("#tupdate"+id).val("");  
        jq('#bid-container'+id).animate({ backgroundColor: "#659ae0" }, 50);
        jq('#bid-container'+id).animate({ backgroundColor: "#FFF" }, 500);

    },
    error: function(xhr, errorString, exception) {
        alert("xhr.status="+xhr.status+" error="+errorString+" exception=|"+exception+"|");
    }
});
}
这段代码在Firefox或Chrome中非常有效。
所以问题是,当我第一次单击bid时,它可以工作,但当我转到第二页时(代码如下):

(单击触发ajax调用并显示第二页)然后此
函数bid(id)
停止工作。我搜索了一些解决方案,比如,
cache:false,
adding
newdate().time()
以JSON格式发布数据,但没有运气。
(当我试图以JSON格式发布数据时,我也遇到了一些语法错误:意外的token<和parse error等等)。我只是想用这段代码找出最简单的解决方案。。。有什么想法吗

如果当前正在将单击处理程序绑定到:

$("selector").click(function...);
将其更改为:

$("#show-category").on("click", "selector", function ...);

这是必要的,因为
pageClick()
替换了以前具有click绑定的DOM元素。您需要使用在整个页面替换过程中保留的父元素的委派。

好的,我找到了解决方案。Internet Explorer在jquery动画方面有问题。我有一个旧的,这是造成问题,并没有完全执行脚本。我必须加入最新的
才能在IE中工作。现在效果很好。

这解决了我的问题:

$.ajax(url,
{
cache: false,
success: function(){
//do something
}
}
);
原因是,只要get请求中的请求相同,某些浏览器就会缓存结果

例如:

function showBootstrapModalPopup(url, containerId, modalId)
{
        $.ajax(url,
        {
            cache: false,
            success: function (data) {
                //do something
                $('#' + containerId).html(data);

                $('#' + modalId).modal('show');
            }
        }
        );


    //$.ajax({
    //    url: url,
    //    success: function (data) {
    //        $('#' + containerId).html(data);

    //        $('#' + modalId).modal('show');
    //    },
    //    cache: false
    //});
}

你如何“进入第二页”?您是否正在修改DOM并替换具有单击处理程序的元素?然后你需要重新绑定处理程序,或者使用delegation with
.on()
。我已经更新了帖子并添加了代码如何进入第二页……出价是否在
#show category
中?是的。使用pageClick()我将页码发布到auctions ajax(php文件),它返回来自数据库的回音输出(在本例中按页面排序),一个完整的拍卖(使用complete,我的意思是输出是用css设计的,所以一个…)谢谢。。但是我没有你说的“点击”功能->
$(“选择器”)。点击(功能。页面在ajax php文件中被调用,如下所示:
在本例中,转到第一页。然后这个
函数页面点击(页面)
执行。。。谢谢你的帮助!这是进入下一页的代码。您是如何绑定函数来单击出价的,这是否也是使用
onclick
?这是用AJAX加载的HTML中的绑定吗?是的,也是在AJAX->AJAX php文件中。当我单击BID按钮时,它会触发这个javascript
函数BID(id)
,而不会在上下文中看到所有内容,很难猜测应用程序中出了什么问题。您在控制台中看到任何错误吗?在inspector中查看DOM时,是否看到
onclick
属性,它的参数是否正确?
onclick
应该是
onclick
。这可能是问题所在吗?
$.ajax(url,
{
cache: false,
success: function(){
//do something
}
}
);
function showBootstrapModalPopup(url, containerId, modalId)
{
        $.ajax(url,
        {
            cache: false,
            success: function (data) {
                //do something
                $('#' + containerId).html(data);

                $('#' + modalId).modal('show');
            }
        }
        );


    //$.ajax({
    //    url: url,
    //    success: function (data) {
    //        $('#' + containerId).html(data);

    //        $('#' + modalId).modal('show');
    //    },
    //    cache: false
    //});
}