I have small ajax problem related to cross domain as i see it.
On localmachine i created html example with some ajax: in registration text field user types 'username', on every keystroke ajax sends it to local Tomcat, where servlet checks if that username is already used and sends 'taken' reponse back.
No problem on localhost at all. As soon as i type used 'username' servlet sends 'taken' response and browser displays it.
But, when i put test html page with ajax on remote machine (some free hosting on remote network) that sends validation request on my localhost Tomcat, connection is made, in Tomcat console i see request comming, and in firebug in Mozzila this is Console ouput:
GET http://89.216.182.25:8080/Dinamicki1/UsernameServlet?username=zik 200 OK
...but in response tab there is not servlet response 'taken' and message in firebug is in red color
So servers communicate well, no firewall problems, response is 200 OK
But response body is empty.
Any ideas what this red messages in firebugs are?
Thank you very much in advance.
And if anyone can recommend a some serious ajax tutorial for java it will be highly appreciated :)
You need to use a domain-relative URL in your Ajax request:
/Dinamicki1/UsernameServlet?username=zik
Or a context-relative URL (assuming that the page is served from /Dinamicki1
):
UsernameServlet?username=zik
With regard to "Ajax tutorial for Java", start here: How to use Servlets and Ajax?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With