jenney.qiu

导航

使用JQuery的get或post方法时出现页面没法手动刷新?

今天做个类似新浪的评论,使用的是JQuery的Ajax方法,这种方法确实不会整个的刷新页面,但是却发现连本人按F5页面都没有反应。
遇到此问题的朋友可以试着用下面的方法来解决:

很简单,添加一个参数  cache:false,

如:

function getComments(userid, type) {
            $.ajax({
                type: "GET",
                url: "GetComments.aspx",
                data: "userid=" + userid + "&type=" + type,
                cache: false,
                error: function() { alert("获取评论信息失败"); },
                success: function(comments_data) {
                    $("#ulList").html(comments_data);
                }
            });
        }

posted on 2012-02-09 17:56  jenney.qiu  阅读(884)  评论(0编辑  收藏  举报