CodeIgniter Forums
Codeigniter and JQuery - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Codeigniter and JQuery (/showthread.php?tid=59717)



Codeigniter and JQuery - El Forum - 11-08-2013

[eluser]Unknown[/eluser]
I'm creating a chat system using Codeigniter and I need to update a textarea with a field in the database each second.
For that I'm trying to use jquery for the timer but I don't know how I can update the textarea with data from the database, with a call from the jquery function.

Can you please help?

My thanks in advanced


Codeigniter and JQuery - El Forum - 11-08-2013

[eluser]Otemu[/eluser]
Hi,

To achieve something like this, you will need to use Ajax, quite a few tutorials so check them out:

http://net.tutsplus.com/tutorials/javascript-ajax/5-ways-to-make-ajax-calls-with-jquery/
http://www.sitepoint.com/ajax-jquery/
http://www.w3schools.com/jquery/jquery_ajax_intro.asp

Basically your timer will need to make an Ajax call, which will get the results from the database and update your textfield, looking at tutorials above should help you achieve this, if you have issues just post your code and we will do are best to try help