【发布时间】:2012-11-22 17:29:21
【问题描述】:
我的问题很简单。
我有很多链接,例如:
$this->Html->link(__('Calculer'), 'log_import/'.$suivi['Suivi']['date'], array('class' => 'logImport')
如您所见,我的“a”标签的 href 属性在每个链接上都会发生变化(诸如“2012-01-01”、“2012-10-15”等日期...)
当我点击我的链接时,jquery 代码正在执行:
$this->Js
->get('.logImport')
->event('click',
$this->Js->request(
array('action' => '$(this).attr("href")'),
array('async' => true,
'update' => '#test')
));
我得到一个错误,因为 ajax 请求使用的 URL 是:
/suivis/$(this).attr("href")
而不是:
/suivis/log_import/2012-01-01
【问题讨论】:
-
你怎么不使用 JsHelpers Link 方法? [链接] (book.cakephp.org/2.0/en/core-libraries/helpers/…)