• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ajax status code 0

 
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What's creating the response with a status cod of zero?
 
Wendy L Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 L Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 L Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 L Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 15385
6
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 L Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic