I have a query with upload real time data to load in div without refresh in jquery

时间:2015-06-30 13:30:19

标签: javascript php jquery

I am making a chat function, in which I have put the chat records with while loop but I want to get new records with out refresh the div at the real time.

But If no record is updated new so div doesn't refresh because of scroll force me to bottom.

1 个答案:

答案 0 :(得分:0)

使用此(我猜你已安装php,你使用PHP页面):

 var ajaxurl = "updatepage.php(CORRECT URL HERE)";
    var data = {};
data["CurBox"] = document.getElementById(IDOFCHATBOX).innerHTML
    $.post(ajaxurl, data
    , function (response) {
        func(response);
    }); 

并确保您检查当前聊天框与更新时的聊天框不同! :)
使用refreshscript中的post方法获取当前的聊天室内容