svgmx5 Posted September 28, 2010 Share Posted September 28, 2010 can anyone help me figure out how i can update a database with out refreshing the page? I know i have use ajax to communicate with the php script that updates the database. But i'm not sure how. I want the database to just update the count every 2 seconds, and echo the counter as well. So basically i have a page with a counter that displays t he number of counts that are stored in the database. And every 2 seconds the database is updated using ajax and the counter is displayed as well...can anyone help me out? i've looked online for several tutorials, scripts and i can't find much. Link to comment https://forums.phpfreaks.com/topic/214597-use-ajax-to-update-a-database/ Share on other sites More sharing options...
trq Posted September 28, 2010 Share Posted September 28, 2010 Ajax is simple using a library like jQuery. http://api.jquery.com/jQuery.ajax Link to comment https://forums.phpfreaks.com/topic/214597-use-ajax-to-update-a-database/#findComment-1116659 Share on other sites More sharing options...
svgmx5 Posted September 28, 2010 Author Share Posted September 28, 2010 i got most of that down, but what i'm having problems with is refreshing the page every 2 seconds. i have no clue on how or where to start at. Link to comment https://forums.phpfreaks.com/topic/214597-use-ajax-to-update-a-database/#findComment-1116662 Share on other sites More sharing options...
trq Posted September 28, 2010 Share Posted September 28, 2010 window.setInterval(function() { // ajax call in here. }, 2000); Link to comment https://forums.phpfreaks.com/topic/214597-use-ajax-to-update-a-database/#findComment-1116711 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.