div('myajaxelement'); //the name of the controller containing requested method $mycontroller = 'Mycontroller'; //requested method $mymethod = 'mymethod'; //elements to update with ajax $myajaxelements = array('common' => 'myajaxelement'); //view params you want to send to the method //_____________________________________________________________________________________________default values_________________________________ajax values___________ (!isset($mycontrollermymethod )) ? $mycontrollermymethod = array('myfirstparam' => 'foo','mysecondparam'=> 'bar') : $mycontrollermymethod; //call ajaxThis to build the path to requested method according to the current view $ajaxRequest = $ajaxthis->ajaxThis($mycontroller,$mymethod,$myajaxelements,$mycontrollermymethod); //my ajax request echo $ajax->div('myelement',array('onclick' => $ajax->remoteFunction(array('update' => $ajaxRequest['update'], 'url' => $ajaxRequest['url'])))); //whatever $myfirstparam = $mycontrollermymethod['myfirstparam']; $mysecondparam = $mycontrollermymethod['mysecondparam']; echo $mysecondparam; echo $myfirstparam; echo $ajax->divEnd('myelement'); echo $ajax->divEnd('myajaxelement'); ?>