Don't use $.load. Use $.ajax (or $.get or $.post). $("#userlogin", "#container").everyTime(7500,function() { $.ajax({ url: '/ajax/userlogin', type: 'POST', dataType: 'html', success: function(data) { if (data) { $(this).animate(...); } } }); });
This assumes that your everyTime function is working. I'm not sure what that is. On Mar 16, 6:39 pm, Brendan <bcorco...@gmail.com> wrote: > I'm not sure where to begin asking for help on this one, so I'll just > explain what I'm trying to do. > > What I want to do is show a notification on the page when another user > logs in. > > Say I am User A, and User B logs in, I want to see a notification that > User B has logged in. > > Right now I have a somewhat working version of this... > > $("#userlogin", "#container").everyTime(7500,function() { > > $(this).load("/ajax/userlogin"); > > if($(this).text() != '') { > > $(this).animate({ > top: "0px" > }, 1000).animate({ > margin: "auto" > }, 2500).animate({ > top: "-50px" > }, 1000, function() { $(this).empty(); }); > } > > }); > > I am using the plugin that runs a function every specified interval... > so right now my logic is that every 7.5 seconds, I run an ajax call to > load in content from the ajax url... and if it is not blank, animate > the notification. > > It sounds like it would already work, and it does sometimes... but > sometimes i STILL get a blank notification... even though that if > check for no content is there. > > Any ideas on how I could make this more reliable or do it better?