Could you help me to fix the post update code automatically

naser Naser Posted in Performance and Scalability 4 years ago

> <script>
$(document).ready(function() {
$(".user-activity").load("index.php");
var refreshId = setInterval(function() {
$(".user-activity").load('index.php');
}, 9000);
$.ajaxSetup({ cache: false });
});
</script>

I wrote this code to update the class

.user-activity

Automatically

But the file index.php is incorrect and because I am new I hope to help

Replies
us Rishi B Replied 4 years ago

actually, maybe I spoke too soon... if you only want to refresh that div, you'll have to make a file that outputs only the contents of what you'd see that in that div (i.e. all the wall posts).

us Rishi B Replied 4 years ago

actually, I think this is what you want to do: https://www.opensource-socialnetwork.org/discussion/view/2990/automatically-refreshing-the-news-feed

I explained the solution in that post, it's easy.

us Rishi B Replied 4 years ago

you're loading the file index.php into the user-activity class with that code. you need the file that you load into that div to contain an updated listing of posts (what usually goes in that div). you can write such a file yourself or get someone to do it for you. if you're interested in doing the latter you can contact me, info in my profile.

us Bryce alvord Replied 4 years ago

What are you trying to solve? Can you give a detailed example of the problem and why you are doing what you are to solve it?