nydeveloper Posted February 11, 2014 Share Posted February 11, 2014 I'm running PHP with CodeIgniter and have completed some functions, run every x minutes by cron jobs, that update specific data values in my local DB. The next step of my project is to display these values on my home page, which is simple enough. However, what I'd like to do is display this data in a way that it will auto update every x seconds if that data value has changed in my DB. My assumption is the best way to do this will be via jQuery/AJAX, but this is where I'm stuck. I've done some research and believe that I have jQuery properly enabled in my CI installation, but I'm not clear on the next step. The majority of examples that I've found on the Web deal with handling form data, radio button selections, menu selections, etc without the need for a refresh, button press, page submission, etc. However, I can't seem to find any help on what I'm trying to achieve - which seems fairly straight forward. I realize that this is a PHP forum, and not specific to the CI framework, but the community here seems extremely knowledgable and willing to help out so I figured I'd give it a try first. Any guidance here is appreciated. Thanks in advance for your time. Quote Link to comment https://forums.phpfreaks.com/topic/286107-looking-for-ajaxjquery-solution-with-phpci/ Share on other sites More sharing options...
Skewled Posted March 5, 2014 Share Posted March 5, 2014 Greetings nydeveloper, I think I understand what you're asking for, you would like the data on your page to update at set intervals to reflect the updates performed by your cron jobs? You could use jQuery to do a refresh on the div every x seconds to achieve the result your looking for. This will show you about setInterval() which is what I'm talking about, and I would use this in my success area after polling the server for the new data. http://www.w3schools.com/jsref/met_win_setinterval.asp I hope this helps you out (: -Gaddam Quote Link to comment https://forums.phpfreaks.com/topic/286107-looking-for-ajaxjquery-solution-with-phpci/#findComment-1471531 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.