tags:

views:

641

answers:

2

Hey,

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.

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);

    }

Thanks, Stanni

+1  A: 

Change this:

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

To this:

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

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

karim79
Thanks for the help but now it is kin of zooming in and out from the top left corner.
Ryan
I edited the answer, that should solve your problem
karim79
Awesome, works perfectly now, thank-you very much :)
Ryan
A: 

great dude .. i'm also looking for this .. me too working fine . Thanks a lot :)

Dipen