php - How to show two views of one controller in the same page CAKEPHP -


i have doubt few days ago. hope explain well, , sorry english.

im working cakephp, well, have controllers own views, etc.. happens is: have 2 functions in controller, , want that, when mouse click on 1 element (in case, google chart pie chart) of view "one", want execute other function of controller (that renders view "two") view one, but, in same page.

i know how treat click on pie chart, isnt problem. problem is, how keep visible view 1 when treat click on , go other view two. mean, want have in end, page default 2 views, 1 , two, each has own function in controller, isnt simple view, text, table...

i have tried solutions: requestaction, href of javascript, helpers... dont solution.

i'd grateful if me! question ask me, , hope have explained , understand english!

greetings!

the way can making element 1 of views , add element in other view. can add element in view $his->element('elementname');. see http://book.cakephp.org/1.3/en/the-manual/developing-with-cakephp/views.html more information elements in cakephp.

put $this->element('name'); in div , using ajax might calling function guess. in controller function write this:

$this->set('set variables elements here'); $view = new view($this, false); $content = $view->element('my-element'); json_encode($content); 

and catch response in success part of ajax call.

success: function (data){     $("#div_id").html(data); } 

i hope makes sense.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -