我正在使用Ajax和jQuery提交動態表單。來自Servlet頁面的響應顯示在新頁面
它工作正常,但Servlet的響應顯示在新頁面中。
function call(formid) {
alert(formid);
var form = $(formid); // id of form tag
form.submit(function() {
$.ajax({
type: form.attr('method'), //post method
url: form.attr('action'), //ajaxformexample url
data: form.serialize(), // serialize input data values
success: function (data) {
var result=data;
$('#content').html(result); //showing result
}
});
return false; // not refreshing page
});
}
我如何顯示Servlet在同一頁中的響應?
(out.println("<br/>Massage = "+message+"<br/>"););
請閱讀https://stackoverflow.com/help/how-to-ask。 –