Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/423.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使用cakephp 2.2 jshelper调用其他jshelper函数?_Javascript_Cakephp_Cakephp 2.0 - Fatal编程技术网

Javascript 如何使用cakephp 2.2 jshelper调用其他jshelper函数?

Javascript 如何使用cakephp 2.2 jshelper调用其他jshelper函数?,javascript,cakephp,cakephp-2.0,Javascript,Cakephp,Cakephp 2.0,我有以下代码: $this->Js->get('#get_meters_today')->event('click', $this->Js->request( array('action' => 'getMetersToday'), array('async' => true, 'update' => '#meters_today') ) ); $this->Html->scriptBl

我有以下代码:

$this->Js->get('#get_meters_today')->event('click',
    $this->Js->request(
        array('action' => 'getMetersToday'),
        array('async' => true, 'update' => '#meters_today')
    )
);

$this->Html->scriptBlock(
    $this->Js->domReady(
        $this->Js->request(
            array('action' => 'getMetersToday'),
            array('async' => true, 'update' => '#meters_today')
        )
    ), array('inline' => false)
);
我想做的是让
Js->request
编写一次,并由
click
方法和
domReady
方法引用。我该怎么做


感谢

IMO,手工编写jQuery脚本要容易得多,而且只使用JsHelper将它们添加到缓冲区。通过这种方式,您可以更好地控制Javascript,并且更容易调试。我还认为,使用JsHelper是一种可怕的做法,这通常会使事情变得更加困难。