Jump to content

Looking for AJAX/jQuery solution with PHP/CI


nydeveloper

Recommended Posts

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.

  • 4 weeks later...

 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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.