Greetings!
I'm having a problem getting a text value of a captcha from a servlet through ajax call.
When my captcha gets created, its text value is written to session, but after refreshing the image itself though ajax call, I only get one old value of the text.
Refreshing the image itself works ok, but I'm stuck getting the correct values from the session on subsequent call.
On page reload I get both the new image and its new text value, no joy with ajax though.
This works great for the image refresh:
$("#asos").attr("src", "/ImageServlet?="+((new Date()).getTime()) )
This call to another method to get text value gives me old stuff:
$.ajax({
url:"checkCaptcha",
type:"GET",
cache: false,
success: function( data) {
alert(data);
}
});
Any feedback will be appreciated.
ps: here's the meat of the method getting the call:
PrintWriter out = response.getWriter();
response.setContentType("text/html");
response.setDateHeader("Expires", 0 );
// Set standard HTTP/1.1 no-cache headers.
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
// Set IE extended HTTP/1.1 no-cache headers (use addHeader).
response.addHeader("Cache-Control", "post-check=0, pre-check=0");
// Set standard HTTP/1.0 no-cache header.
response.setHeader("Pragma", "no-cache");
out.print( request.getSession( ).getAttribute("randomPixValue") );
out.close();