尝试在没有使用JQuery和Ajax刷新网页的情况下显示数据库中的值已成功显示此内容但是“服务于:/项目名称”将附加到显示的值
脚本:
println("QUERY - DELETE COMMENTS")
var query = PFQuery(className: "Comments")
var post = currentObject
query.whereKey("bellongsToPost", equalTo: post)
query.findObjectsInBackgroundWithBlock { (comments: [AnyObject]?, error: NSError?) -> Void in
for comment in comments! as [AnyObject]
{
comment.deleteInBackground()
}
}
的Servlet
$(document).ready(function() {
$('#AESASJOBRUNOPTION').change(function() {
var AESASJOBRUNOPTION = $('#AESASJOBRUNOPTION').val();
$.ajax({
type:'POST',
url: "AESASJobCurrentOpenPeriod",
data: {AESASJOBRUNOPTION: AESASJOBRUNOPTION},
cache: false,
success: function(result) {
$("#result1").html(result);
$("#result1").html(result).slideDown('slow');
}
});
});
});
答案 0 :(得分:1)
如果您的项目使用的是Eclipse中的JET Template,则doPost
方法appends看起来更像Served at: <PATH>
。
如果使用JET模板,以下是可能的解决方案:
Window -> Preferences -> Java EE
GET
而不是POST
如果未使用JET模板,以下是Javascript级别的解决方案:
$(document).ready(function() {
$('#AESASJOBRUNOPTION').change(function() {
var AESASJOBRUNOPTION = $('#AESASJOBRUNOPTION').val();
$.ajax({
type:'POST',
url: "AESASJobCurrentOpenPeriod",
data: {AESASJOBRUNOPTION: AESASJOBRUNOPTION},
cache: false,
success: function(result) {
result_without_path = result.replace(/Served at:[\/a-zA-Z0-9]*/i,'');
$("#result1").html(result_without_path);
$("#result1").html(result_without_path).slideDown('slow');
}
});
});
});
答案 1 :(得分:1)
您也可以在servlet中查找响应编写器,它可能会写出响应,如:
response.getWriter().append("Served at: ").append(request.getContextPath());
然后你可以从你的servlet中评论这一行。