I am using Servlet as controller and jquery to send request to server. Following is my jquery request
$.post("login", {userName:$userName, password:$password}, function(data, textStatus) {
alert(textStatus);
});
And in server side i have written following code
response.setContentType("text/plain");
PrintWriter out = response.getWriter();
out.println("" + strError + "");
out.flush();
out.close();
I want to set error message and error error status code in servlet and read the same status code in jquery. How can I achieve the same?