AJAX刷新脚本 [英] AJAX refresh script

查看:51
本文介绍了AJAX刷新脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些AJAX可以刷新我的页面,但也可以使正在刷新的div在刷新时上下浮动,但是我不愿意这样做,我只是不愿意刷新.

I have some AJAX that refreshes my page but also makes the div that it is refreshing go up and down as it refreshes but i don't wont it to do that, I just wont it to refresh.

我将如何编辑此代码以最小化和最大化div?

How would I edit this code to take out the minimizing and maximizing of the div?

var _v = 0;
var _v2 = 1;


    function ajax_update()
    {
        var wrapperId   =   '#content';
        var postFile    =   'jquery.php';
        _v++;
         _v2++;
        $.post(postFile, { v2: _v2 , v: _v}, function(data){$(wrapperId).slideUp('2000',function(){$(this).html(data).slideDown();}).html();});
        setTimeout('ajax_update()', 2000);

    }

谢谢,斯坦尼

推荐答案

更改此内容:

$.post(postFile, { v2: _v2 , v: _v}, function(data){
    $(wrapperId).slideUp('2000',function(){
        $(this).html(data).slideDown();
    }).html();
});

对此:

$.post(postFile, { v2: _v2 , v: _v}, function(data) {
    $(wrapperId).html(data);
});

现在将只替换包装器的内容,不显示/隐藏,只刷新 $(wrapperId)的内容.

Edited: Will now just replace the contents of the wrapper, there will be no showing/hiding, just refreshing of the contents of $(wrapperId).

这篇关于AJAX刷新脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆