I have an AJAX client which retrieves a simple string literal (at least tries to) response from a Restful Resource on the server, using a simple Java Client I can see the response OK and do anything with it; But when I use AJAX to retrieve response, the status comes as 0 for XMLHttpRequest Object, despite the fact that readyState value is set to 4. Below is my JS client code:
My Restful resource uses Jersey RS implementation, Here's the code for my Resource:
I built a TestNGtest case for the same, using simple client code:
^^ The above java code gives response : 200 ... But in case of AJAX client, I get blank response text, When i check status value it is set to '0', but readyState = 4. Please note that I have to use Native AJAX stuff for this, cannot rely on any third party libraries to make AJAX calls (JQuery, Prototype, Dojo et. al.) unfortunately
Any pointers as to where I am doing something wrong?
Addendum : In case of an AJAX request,
prints on the server, which means the request goes through ... but no response
Thanks for your reply. OK, maybe I over did my log thingie it just helps me debug on firebug better. If you read my entire post though, at the end, I do mention that I can't use, JQuery, Dojo, Prototype, DWR, Moo Tools ... well you get the picture ;)
I understand that there are frameworks that do this kinda thing and condense the code into few lines ...
Addendum: This is not any third party library, it forms part of an open source framework that I am building and working on, here's the link:
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: AJAX response to a Restful Jersey Resource