don*_*yor 5 java ajax jquery playframework-2.0
jQuery代码:
function ajaxsubmit(){
$.ajax({
url: "/update",
type: "POST",
dataType: "html"
}).success(function(data) {
$('#result').html(data);
});
}
Run Code Online (Sandbox Code Playgroud)
和我的Java功能:
public static Result ajaxupdate() {
String done = "very good";
return ok("very good").as("text/plain");
}
Run Code Online (Sandbox Code Playgroud)
提醒[object Object]
而不是纯文本"very good"
.为什么?
添加 dataType: "text" 并将complete() 更改为success()
function ajaxsubmit(){
$.ajax({
url: "/update",
type: "POST",
dataType: "html"
}).success(function(data) {
$('#result').html(data);
});
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
19640 次 |
最近记录: |