我想附加无限数量的 HTML 元素,并以注释形式给出数据。这是我的ajax:
function ajaxsubmit(){
$.ajax({
url: "/update",
type: "POST",
dataType: "html"
}).success(function(data) {
$('#result').html(data);
});
}
和我的 HTML 部分:
<div class="post" id="result"></div>
这是我的服务器端功能:
public static Result ajaxupdate(){
String done = "test";
return ok(done).as("text/html");
}
此功能仅附加一次,如果我第二次单击,则不会附加。是因为我每次都应该有不同的ID吗?这怎么可能(就像在stackoverflow中,几个评论是如何工作的!)
提前致谢..