wood burning stoves*
The moose likes HTML, CSS and JavaScript and the fly likes Ajax no response Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Ajax no response" Watch "Ajax no response" New topic
Author

Ajax no response

Sahana Hegde
Ranch Hand

Joined: Jan 27, 2008
Posts: 67
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
Marshal

Joined: Mar 22, 2005
Posts: 41062
    
  43
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?


Ping & DNS - my free Android networking tools app
Sahana Hegde
Ranch Hand

Joined: Jan 27, 2008
Posts: 67
My apologies.

I have checked in Mozilla and IE. Does not work in both.
Sahana Hegde
Ranch Hand

Joined: Jan 27, 2008
Posts: 67
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
Marshal

Joined: Mar 22, 2005
Posts: 41062
    
  43
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

Joined: Jan 27, 2008
Posts: 67
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
I am wondering if you have an issue with variable scope. Your var xmlHttp is local.

Eric
Sahana Hegde
Ranch Hand

Joined: Jan 27, 2008
Posts: 67
Nope. I tried making it global. Same results.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Sep 13, 2007
Posts: 2231
    
    7

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.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
Sahana Hegde
Ranch Hand

Joined: Jan 27, 2008
Posts: 67
Hi Guys,

For some reason,



this works perfectly.
But this does not


Thanks
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Looks like there is no difference. Make sure you do not have a typo.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ajax no response
 
Similar Threads
refresh an HTML table using AJAX and JSP
Resfresh page and getting values when option is selected
How to display value in combo box using AJAX
problem with sending # character through ajax
Regading getElementById