Welcome Guest, Not a member yet? Register   Sign In
howto load mvc in div from menu in other div
#1

[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.
#2

[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-jq...deigniter/

#3

[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
#4

[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.





Theme © iAndrew 2016 - Forum software by © MyBB