howto load mvc in div from menu in other div - 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: howto load mvc in div from menu in other div (/showthread.php?tid=57405) |
howto load mvc in div from menu in other div - El Forum - 03-12-2013 [eluser]Unknown[/eluser] I have a mvc where one div contains a menu. From this menu I want to load another mvc in another div, sort of iframe in the past. Doing this with a complete screenrefresh is not difficult, but I do not want to refresh the menu and footer, only the div with the data. How do I do this with CI. I want to keep the mvc intact, that is, one mvc for everything on the screen and a mvc per datapage. howto load mvc in div from menu in other div - El Forum - 03-12-2013 [eluser]Otemu[/eluser] Hi, Your need to look at using Ajax to achieve this, check out an example here using Ajax http://www.jotorres.com/2012/01/using-jquery-and-ajax-with-codeigniter/ howto load mvc in div from menu in other div - El Forum - 03-12-2013 [eluser]Unknown[/eluser] Thanks, So I looked at your example and search for some more using 'ajax' in google . Ended up with the following, no ajax but it works $("#selection").click(function(){ $("#theDivName").load("<?php echo base_url().'index.php/theController/theMethod'?>"); }); works like a charm, thanks again for pointing me in the right direction howto load mvc in div from menu in other div - El Forum - 03-13-2013 [eluser]Otemu[/eluser] Glad I helped, you actually are using ajax, the jQuery load() method is a simple way to make an ajax call to load data from a server and puts the returned data into the selected element. Using firebug or Chrome you can track ajax requests which can come in handy when you need to debug. |