File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes I am getting unspecified error 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 "I am getting unspecified error" Watch "I am getting unspecified error" New topic

I am getting unspecified error

Veshnu Ramakrishnan
Ranch Hand

Joined: Sep 27, 2005
Posts: 44
When i try to set a header like this
req.setRequestHeader("Content-Type", "text/xml");

i am getting an unspecified javascript error at this point. i couldn't set anything to my header. can anyone help me out in this.

Veshnu<br />SCBCD<br />SCWCD<br />SCJP
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
Are you setting after the open() method has been declared?

Veshnu Ramakrishnan
Ranch Hand

Joined: Sep 27, 2005
Posts: 44
no i am setting it before the open method
var idField = document.getElementById("searchQuery").value;
var action = document.getElementById("action").value
var url = "http://localhost:7001/cplus/go";
if (window.XMLHttpRequest) {
alert("xml http");
req = new XMLHttpRequest();
alert("No http xml");}
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){alert("No Active X");}
req.setRequestHeader("ACTION", action);
req.setRequestHeader("Content-Type", "text/xml");"POST", url, true);
req.onreadystatechange = callback;

This is my code snippet
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

Shouldn't you open the request before setting the headers ?

[My Blog]
All roads lead to JavaRanch
I agree. Here's the link:
subject: I am getting unspecified error
It's not a secret anymore!