This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes How to change content type in XMLHttpRequest? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to change content type in XMLHttpRequest?" Watch "How to change content type in XMLHttpRequest?" New topic
Author

How to change content type in XMLHttpRequest?

Palani Kumar
Greenhorn

Joined: May 28, 2008
Posts: 13
I want to change content type "text/html" to "text/xml". How to do this? XMLHttpRequest.setRequestHeader( "Content-Type", "text/xml;charset=UTF-8"); is not working...
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Not working in what way? What effect did you expect it to have? What happened instead?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

Are you trying to set the request or the response header?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Palani Kumar
Greenhorn

Joined: May 28, 2008
Posts: 13
Actually here i'm passing xml as string. If I pass as xml it works fine. It does not working if I pass xml as string i'm receiving error
Problem retrieving data
. What should I change to work fine. Here is my code.


Thanks
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

This question seems to be about Javascript. Let's move it to a more suitable forum.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How to change content type in XMLHttpRequest?
 
Similar Threads
How to display XML documents using JSP?
Does Tomcat send content-type using a strange format in header? (Can I change this?)
parsing the xml returned from ajax call
AJAX 'POST' xml request to server
Can I used XML tag inside Servlets?