我有一個jQuery UI框將數據傳遞到我的servlet上,如果servlet失敗請求,我有這個設置;JQUERY成功返回
response.setContentType("text/xml");
response.setHeader("Cache-Control", "no-cache");
response.getWriter().write("<valid>false</valid>");
如何從成功函數訪問此? (或者是錯了嗎?)
這裏是我的jQuery代碼:
$.ajax({
//this is the servlet file that processes the data and send mail
url: "Register",
//GET method is used
type: "POST",
//pass the data
data: data,
//Do not cache the page
cache: false,
//success
success: function (response) {
//$("#message").append(response);
}
你可以在這裏提供更多的上下文嗎?我認爲這個「成功」回調是AJAX請求的一部分? – 2011-03-04 18:34:59
我已經添加了我的完整代碼,即時製作一個註冊框,它目前正常工作,但我不確定如何爲用戶添加警報以說明它是否成功。 – Lunar 2011-03-04 18:45:31
你的jQuery在哪裏向servlet發出請求呢? – justkt 2011-03-04 19:30:59