Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ajax status code 0

 
Wendy Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64975
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's creating the response with a status cod of zero?
 
Wendy Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64975
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic