Hi,
I was going through "Head first Ajax". There in chapter 2, we are having a registration page. Once we enter username field we make a check thorough ajax request object.
The flow is somewhat as below
registration.html--->javascript(var url = "checkName.php?username=" + username;)--->checkName.php.
Now in our checkName.php we are creating an array, and checking the parameter send by request URL againt it as below-:
where as in our javascript we are looking for the response as-:
Now this is fine with php as response from server will be just "Okay" or "denied". But as i dont know php am using a
Jsp in place of it as shown-:
and my javascript as-:
But now the problem is that unlike php response of just "okay" or "denied" i shall be getting full jsp as a response with "exists" in body tag if user exists.
so this can't match the condition i have written in my javascript (request.responseText!= "exists").
Is there a way to overcome this? Using request.responseXML instead of request.responseText ?