CodeIgniter Forums
How do we justify this logic of CI with JQuery/AJAX? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: How do we justify this logic of CI with JQuery/AJAX? (/thread-35263.html)



How do we justify this logic of CI with JQuery/AJAX? - El Forum - 10-24-2010

[eluser]zrowcrypt[/eluser]
JQuery's AJAX ".get" method calls a (php page)method of a controller and the returned data is further processed....but then as we consider it a best practice, controllers are meant to just transfer control to the models and views..A controller never returns anything or echoes any data...so how can we support this argument? I may be wrong..still in the initial learning stages so pardon me if you find the question a bit too naive Sad.

One eg. is JQuery's autocomplete plugin that I was trying to implement which expects an array of users name from the database. Generally, with CI..the flow is View form -> Controller -> Database Model(DATA) -> Controller (DATA)-> Another view...but if I have to implement the JQuery/AJAX way then the controller will have to output data so that the AJAX calling function (get) can grab it. Right?

Thanks for replying.