English 中文(简体)
Zend Framework ajaxLink params not being sent to ctr/action methods
原标题:Zend Framework ajaxLink params not being sent to ctr/action method
  • 时间:2009-10-02 21:25:28
  •  标签:

我有一个简单的AjaxLink与一名控制员。 在我增加一个小段时,我有了一个错误:

这段话语是需要的,我看到这些弹片是ZF制造的。 这里是生成的联合材料(我是模块):

$(document).ready(function() {
    $( a.ajaxLink1 ).click(function() { $.post( /ez/contacts/testy , {"param1":"1","param2":"456"}, function(data, textStatus) { $( #testy ).html(data); },  html );return false; });
});

这里是我的AjaxLink:

<div id="testy"></div>
<?= $this->ajaxLink("Example 2",
"/ez/contacts/testy",
array( update  =>  #testy ,
       class  =>  someLink ),
array( param1  =>  1 ,
       param2  =>  456 )); ?>

感谢任何帮助

最佳回答

I found the answer. You don t send the vars directly to the function, they are sent via GET or POST.

Here is how I got the vars. $param1 = (int)$this->_request->getParam( param1 ); $param2 = (int)$this->_request->getParam( param2 );

Here is the entire function: public function testyAction(){

//The request was made with JS XmlHttpRequest
$this->_helper->viewRenderer->setNoRender(); //Will not render view
    $this->_helper->Layout->disableLayout(); // Will not load the layout
$param1 = (int)$this->_request->getParam( param1 );
$param2 = (int)$this->_request->getParam( param2 );

    echo  testy 123. params sent were:  .$param1. ,  .$param2; 

iii

问题回答

暂无回答




相关问题
热门标签