CodeIgniter Forums
Structure for 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: Structure for Jquery/Ajax (/thread-45901.html)



Structure for Jquery/Ajax - El Forum - 10-10-2011

[eluser]jamgood96[/eluser]
I'm building a customer client/project database for the company I own/work for. Things are going fine, but I'm having a brain-fart when it comes to laying out the MVC structure.

Currently I have a client page that has a list of clients to the left, with it dynamically sortable based on user selectable filters. This is setup to have javascript/jquery do an ajax post to a the method filterClients that is within a jquery controller I have setup. This method then access's a model that interacts with the database to gather the proper users and their information. This info is then returned to the jquery/filterClients method. Where I'm struggling is what do I do with this data. Currently it is being formatted (HTML) and echo'd out in the same controller back to the original page into a div, but I'm under the impression this isn't a good thing to do. But what is the alternative?

Do I create a custom view to format it, then load this view into the div on the page? I've attached a screenshot of the basic layout. Hopefully it helps clear things up, but I'd be happy to try to explain better if need-be.

Thanks!

James