jQuery的code:
jQuery code:
function ajaxsubmit(){
$.ajax({
url: "/update",
type: "POST",
dataType: "html"
}).success(function(data) {
$('#result').html(data);
});
}
和我的Java功能:
public static Result ajaxupdate() {
String done = "very good";
return ok("very good").as("text/plain");
}
警报是给 [对象的对象]
,而不是纯文本非常好
。为什么?
the alert is giving [object Object]
, instead of plain text "very good"
. why?
添加数据类型:文字,改变完整的()成功()
add dataType: "text" and change complete() with success()
function ajaxsubmit(){
$.ajax({
url: "/update",
type: "POST",
dataType: "html"
}).success(function(data) {
$('#result').html(data);
});
}