help on creating an auto refresh on post

+3 OLayemii Garuba · August 24, 2015
am creating a kind of 'what's on your mind" script and I did the posting to the database via jquery so no reload of page is needed to post... problem is... how do I update the stories on the page since it doesn't refresh the page it doesn't change the contents unless I reload the whole page my self ...I once used a jquery setInterval function though it was working.. when I wanted to set limit to my SQL query. like (LIMIT 0,10) it repeats the posts whenever the div refreshes due to the setINTERVAL function... any help?

Post a Reply

Replies

Oldest  Newest  Rating
0 shiva kumar · August 28, 2015
so you are posting values to database using ajax right..

do one thing in the same ajax call get the data what you want to show in the timeline..

example:

 posting data using jquery and ajax:

-----> hi good morning
------> save this in db using ajax
------> and get the same value with html (in which design you need to show in the timeline or use json  )
---> then append the output into the before of the existing post..

lets say default you have a post like 

** Good night (this is the latest on before you post to db..)
**The above post("Good night") is having some html div tag right so append the posted data before this html div tag..
0 Marco Schindler · August 28, 2015
If the data does update if you reload the page it's more likely to be an error with your jQuery function.

Please provide your code so I can help you further.
  • 1

PHP

107,211 followers
About

Server-side, HTML embedded scripting language used to create dynamic Web pages.

Links
Moderators