mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Fixing issues where chained jQuery engine requests wouldn't eval() script elements, making ajax pagination much harder.
This commit is contained in:
parent
32113a4c88
commit
be7ce6e923
2 changed files with 4 additions and 3 deletions
|
@ -245,6 +245,7 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
|
|||
} else {
|
||||
$success = 'function (data, textStatus) {$("' . $options['update'] . '").html(data);}';
|
||||
}
|
||||
$options['dataType'] = 'html';
|
||||
$options['success'] = $success;
|
||||
unset($options['update']);
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ class JqueryEngineHelperTestCase extends CakeTestCase {
|
|||
$result = $this->Jquery->request(array('controller' => 'posts', 'action' => 'view', 1), array(
|
||||
'update' => '#content'
|
||||
));
|
||||
$expected = '$.ajax({success:function (data, textStatus) {$("#content").html(data);}, url:"\/posts\/view\/1"});';
|
||||
$expected = '$.ajax({dataType:"html", success:function (data, textStatus) {$("#content").html(data);}, url:"\/posts\/view\/1"});';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = $this->Jquery->request('/people/edit/1', array(
|
||||
|
@ -184,7 +184,7 @@ class JqueryEngineHelperTestCase extends CakeTestCase {
|
|||
'method' => 'post',
|
||||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = '$.ajax({success:function (data, textStatus) {$("#updated").html(data);}, type:"post", url:"\\/people\\/edit\\/1"});';
|
||||
$expected = '$.ajax({dataType:"html", success:function (data, textStatus) {$("#updated").html(data);}, type:"post", url:"\\/people\\/edit\\/1"});';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = $this->Jquery->request('/people/edit/1', array(
|
||||
|
@ -195,7 +195,7 @@ class JqueryEngineHelperTestCase extends CakeTestCase {
|
|||
'data' => '$("#someId").serialize()',
|
||||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = '$.ajax({data:$("#someId").serialize(), success:function (data, textStatus) {$("#updated").html(data);}, type:"post", url:"\\/people\\/edit\\/1"});';
|
||||
$expected = '$.ajax({data:$("#someId").serialize(), dataType:"html", success:function (data, textStatus) {$("#updated").html(data);}, type:"post", url:"\\/people\\/edit\\/1"});';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = $this->Jquery->request('/people/edit/1', array(
|
||||
|
|
Loading…
Reference in a new issue