GeeCON Prague 2014*
The moose likes HTML, CSS and JavaScript and the fly likes ajax status code 0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "ajax status code 0" Watch "ajax status code 0" New topic
Author

ajax status code 0

Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

I have closed the old post as i now know more, and feel that was a dead end

this is my html page. I am using the xmlHttpRequest method as it gives me most control to see what is actually happening, as my method was going into the success callback and not the error callback when using jquery.



I am testing inside eclipse and have breakpoints inside my servlet.
I am getting an alert saying "Error: status code is 0"
before I even get to my breakpoint. I get this alert twice and that is it.
I have looked up the status codes and they should all be 3 digits long. I saw one post that suggested this maybe a firewall but as this is all on my localhost, i thought it couldn't be that.
So any other ideas?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61310
    
  66

What's creating the response with a status cod of zero?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

I thought i would add this:
My servlet is being called, the logging is output, and my breakpoint is stopped at. But after the onReadyStateChange function has been called with a status of 4 (ready)

I have been doing more research and these are more options:

- Same domain policy and that just having FindBarAjaxServlet may not match as the same domain.
My call has been changed to


- If it is ZERO than you are using the local file system and that means
success. You only get 200 when you are running on the http protocal.

I am using tomcat, does this apply in that case?
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

Bear Bibeault wrote:What's creating the response with a status cod of zero?


I think that is my question!
I am calling a servlet, which is indeed being called, but after i have recieved the response
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61310
    
  66

Then the servlet isn't creating the response? That doesn't make any sense. What is?

Also, what's with the absolute URL? That's bound to cause issues, if not now, then down the road.
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

Ok this is a firefox issue (3.6.12)
i just tried it on explorer and it worked after giving me this popup "this page is accessing information that is not under its control. This poses a security Risk. Do you want to continue? Y/N".
Or without the prompt if i take the full path out.



Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

i have solved the problem it was the


in the html, i don't know why that was causing it, if anyone could enlighten me i would be grateful
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Status zero happens when

1) Page is being served from file protocol
2) Page exits/refreshes as an active XMLHttpRequest is still being processed. It throws an "INVALID_STATE_ERR " error and sets the status to zero.

Cancel the link/button click and you should be good to go.

Eric

Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

Eric Pascarello wrote:Status zero happens when

1) Page is being served from file protocol
2) Page exits/refreshes as an active XMLHttpRequest is still being processed. It throws an "INVALID_STATE_ERR " error and sets the status to zero.

Cancel the link/button click and you should be good to go.

Eric


Thanks Eric
 
GeeCON Prague 2014
 
subject: ajax status code 0