So I'm using a while statement to line every wall post in a table. Now I want to refresh this every 10 seconds using ajax, possibly setInterval. Here is my wall script:
you need to give the table an id so you can refer to it and then put that inside another div that will function as the container and then use the jquery load() function to load the page via ajax and insert just the table into the div
function refreshPosts(){ $('#container').load('posts.php #table'); }
posts.php could just be the original page - your index.php if that is what it is called, it can reload itself effectively as it only pulls out the bits it needs
I would normally however create a stripped down version for ajax purposes so that it loads faster. A thought would be to then include that posts.php from your original file so you only have one copy of the code to maintain.
Ok.. So the page is profile.php, and I put the table in a div with the id of "wallcontainer" as well as the table id is "wallcont". The code is as following:
function refreshPosts(){ $('#wallcontainer').load('profile.php?id=<?php echo($id); ?> #wallcont'); }
setInterval('refreshPosts()',10000);
I have jQuery loaded and everything, and this is inside the $(document).ready(function(){ -- Now what am I doing wrong? It doesn't seem to update.
whilestatement to line every wall post in a table. Now I want to refresh this every 10 seconds using ajax, possibly setInterval.Here is my wall script:
Any ideas? :)
- Thanks :)
and then use the jquery load() function to load the page via ajax and insert just the table into the div
Also the posts.php, will it just include the php or what?
I would normally however create a stripped down version for ajax purposes so that it loads faster. A thought would be to then include that posts.php from your original file so you only have one copy of the code to maintain.
I have jQuery loaded and everything, and this is inside the
$(document).ready(function(){-- Now what am I doing wrong? It doesn't seem to update.To fault find I would add a button to trigger the refreshPosts function manually, make sure that there isn't an issue with that first
[06:14:33.090] (6:14:33.90) WalkingDomProcessor.process: Can't find engine for: http://schart.net/profile.php?id=1#
[06:14:33.097] (6:14:33.96) WalkingDomProcessor.process: Performing data capturing on: http://schart.net/profile.php?id=1#
[06:14:33.103] (6:14:33.102) WalkingDomProcessor.process: Can't find engine for: http://schart.net/profile.php?id=1#