diff --git a/cake/libs/view/helpers/jquery_engine.php b/cake/libs/view/helpers/jquery_engine.php index 7c592f6e3d6..ccc6e4a941e 100644 --- a/cake/libs/view/helpers/jquery_engine.php +++ b/cake/libs/view/helpers/jquery_engine.php @@ -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']); } diff --git a/cake/tests/cases/libs/view/helpers/jquery_engine.test.php b/cake/tests/cases/libs/view/helpers/jquery_engine.test.php index 527ea7ead8e..dd96654823a 100644 --- a/cake/tests/cases/libs/view/helpers/jquery_engine.test.php +++ b/cake/tests/cases/libs/view/helpers/jquery_engine.test.php @@ -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(