Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-18-2012, 05:01 PM   PM User | #1
Trki
Regular Coder

 
Join Date: Jan 2012
Location: Slovakia
Posts: 108
Thanks: 9
Thanked 0 Times in 0 Posts
Trki is an unknown quantity at this point
Load via scrolling

Hi guys... i have this problem... it works pretty well but when i am trying this in mozilla ... sometimes it load contect two times... and i dont know why... chrome,,, opera... everything is okay... but in mozilla is the contect doubled sometimes...

I tried to add the 'old new data' condition but it didnt help

Code:
jQuery(window).bind('scroll',function() {
   
       
    var $win=$(window);
        if ($win.height() + $win.scrollTop()  == $(document).height()) {
           
    var ID='';    
    ID=$("article:last").attr("id");
    var ID=parseInt(ID);
    
             $.ajax({

               type: "POST",
               url: "/modules/load_another_statuses.php",
               data: {ID: ID  },
               async: false,
               cache: false,
               dataType: "json",          
               beforeSend: function() {
               document.getElementById("loading").style.display = "block";  
               },          
               success: function(data) {
                   
                   var NewData=data.idecko.length;                   
                   
                   if (OldData!=NewData) {
           
                   
                     $('article:last').after(data.idecko);
                     $('a[rel*=facebox]').facebox();
                     
                   }
                     
                    var OldData=data.idecko.length;
                    
                document.getElementById("loading").style.display = "none";
                
               }
                   
            }); 
        }  
        
});
Trki is offline   Reply With Quote
Old 09-18-2012, 08:58 PM   PM User | #2
sayannayas
New Coder

 
Join Date: May 2012
Posts: 25
Thanks: 0
Thanked 1 Time in 1 Post
sayannayas is an unknown quantity at this point
Not exactly sure whether this gonna help you but when i load any data from the database i always do an empty() to the child of the parent div before appending the new datastream.
sayannayas is offline   Reply With Quote
Old 09-18-2012, 11:17 PM   PM User | #3
Trki
Regular Coder

 
Join Date: Jan 2012
Location: Slovakia
Posts: 108
Thanks: 9
Thanked 0 Times in 0 Posts
Trki is an unknown quantity at this point
Quote:
Originally Posted by sayannayas View Post
Not exactly sure whether this gonna help you but when i load any data from the database i always do an empty() to the child of the parent div before appending the new datastream.
yea but i dont want to empty the parent div .. just add another BUT TO BE SURE IT DONT HAVE THE SAME DATA but another from DB
Trki is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:05 PM.


Advertisement
Log in to turn off these ads.