• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ajax no response

 
Sahana Hegde
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,



I am using this javascript. It is called onChange of a drop down. I also tried running the response page individually and it is running fine. In IE it gives an error xmlHttp is undefined. The statechanged is always 0.

What should I do?

Thanks
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello "sarvagna"-

You've been around the ranch long enough to know that we have a policy on screen names here at JavaRanch. It must consist of a first name and a last name. Since yours does not conform with it, please take a moment to change it, which you can do right here.

As to your question, if there's an error about xmlHttp being undefined, it's not surprising that statechanged doesn't change, now is it? Which path through the GetXmlHttpObject method is the code taking? Does it work in other browsers?
 
Sahana Hegde
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My apologies.

I have checked in Mozilla and IE. Does not work in both.
 
Sahana Hegde
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also checked if that path is opening up correctly by giving the same in window.open(url). Thats working correctly. I am using coldfusion to send the response.

[ August 08, 2008: Message edited by: Sahana Hegde ]
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I said, it doesn't matter whether the response works, if the request can't even be sent.

Again: Which path through the GetXmlHttpObject method is the code taking?
 
Sahana Hegde
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I use firefox it creates it comes here xmlHttp=new XMLHttpRequest();, does not work. If I use IE still it takes the same path.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am wondering if you have an issue with variable scope. Your var xmlHttp is local.

Eric
 
Sahana Hegde
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope. I tried making it global. Same results.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just ran the code fine with a few changes [removed the indexof lines and changed the url], make sure you do not have any javascript errors being reported.

Eric
 
K. Tsang
Bartender
Posts: 3509
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi try putting the statechange function inside



If you do get the alert great. If not check your url by simply printing the vendorId parm.
 
Sahana Hegde
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

For some reason,



this works perfectly.
But this does not


Thanks
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like there is no difference. Make sure you do not have a typo.

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic