CodeIgniter Forums
Multiple views 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: Multiple views and Jquery (/showthread.php?tid=14644)



Multiple views and Jquery - El Forum - 01-09-2009

[eluser]kidego32[/eluser]
Hi everyone,

I am designing an app that will partition the viewport into two columns, with the left running the full length of the browser window (top to bottom) and the right column further divided into a top and bottom section.

The page will display a list of customers on the left column, and when a customer is selected, the corresponding customer record will be displayed on the upper section of the right column, and the customer's transactions will be displayed on the lower section of the right column.

I would like to have the upper view (displaying the customer record), as well as the transactions, refresh and update independently from the customer list (left column of the view) when a user clicks on a customer. Can this be accomplished with jquery within the mvc paradigm of codeigniter? If so, can you point me towards any tutorials that may provide some guidance?

Thanks,
Julio


Multiple views and Jquery - El Forum - 01-09-2009

[eluser]Jay Turley[/eluser]
[quote author="kidego32" date="1231564261"]
I would like to have the upper view (displaying the customer record), as well as the transactions, refresh and update independently from the customer list (left column of the view) when a user clicks on a customer. Can this be accomplished with jquery within the mvc paradigm of codeigniter?[/quote]

Yes, it can.

I use jQuery to make POST requests to the /index.php/controller/function/parameter URLs which - typically - return the data in JSON format, and then I parse it and add it to the DOM with javascript. You can also make an AJAX request, and return views, which can be injected into the DOM through innerHTML or some such thing.

If you need more detail let me know, but really all it takes is reading the jQUery documentation for AJAX, making sure that your return data format is correct, and using json_encode() to return your results.