I have php includes in different divs, how can i use ajax to constantly refresh the data outputted from the php file every second, I have multiple things that need to refresh, one per div
2
-
2And what you have tried yet apart from posting this question on SO?Mayank Pandeyz– Mayank Pandeyz2016-12-27 05:44:52 +00:00Commented Dec 27, 2016 at 5:44
-
I have tried methods but they did not let me have all the divs and php files to refresh in one functionStrykes– Strykes2016-12-27 05:48:04 +00:00Commented Dec 27, 2016 at 5:48
Add a comment
|
2 Answers
- Use the javascript function
settimeout - In the
setimeoutfunction, perform the ajax request - Fill the
divelement with the results from the ajax request - Again, use the
settimeoutfunction in the ajax response and perform the step 2 and 3.
2 Comments
sepehr
Please don't ask for upvotes/accepts as it's not considered as constructive. See: Is it acceptable to ask for upvote/accept in an answer when submitting it?
Elijah M
I'm planning out the design for a real-time game, and I was wondering, how often should the
setimeout be? I want it to be real-time, but would having a delay of 0 lag up the server?