Permalink
Browse files

Fixing issues where chained jQuery engine requests wouldn't eval() sc…

…ript elements, making ajax pagination much harder.
  • Loading branch information...
1 parent 32113a4 commit be7ce6e9230e6c61c1dc2a50ee8c48e56a7c1507 @markstory markstory committed Jan 6, 2010
@@ -245,6 +245,7 @@ function request($url, $options = array()) {
} else {
$success = 'function (data, textStatus) {$("' . $options['update'] . '").html(data);}';
}
+ $options['dataType'] = 'html';
$options['success'] = $success;
unset($options['update']);
}
@@ -162,7 +162,7 @@ function testRequest() {
$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 @@ function testRequest() {
'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 @@ function testRequest() {
'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(

0 comments on commit be7ce6e

Please sign in to comment.