Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within HTML Pages with CSS and JavaScript
Search Coderanch
Advance search
Google search
Register / Login
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
Forum:
HTML Pages with CSS and JavaScript
How to change content type in XMLHttpRequest?
Palani Kumar
Greenhorn
Posts: 13
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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
Marshal
Posts: 28193
95
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Not working in what way? What effect did you expect it to have? What happened instead?
Bear Bibeault
Sheriff
Posts: 67746
173
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Are you trying to set the request or the response header?
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
Palani Kumar
Greenhorn
Posts: 13
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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.
createXmlObject = function(xmlString) { var xmlhttp; xmlhttp=null; if (window.XMLHttpRequest) {// code for Firefox, Opera, IE7, etc. alert("safari"); xmlhttp=new XMLHttpRequest(); xmlhttp.overrideMimeType('text/xml'); } else if (window.ActiveXObject) {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } if (xmlhttp!=null) { xmlhttp.onreadystatechange=stateChange; xmlhttp.open("GET",xmlString,true); xmlhttp.send(null); } else { alert("Your browser does not support XMLHTTP."); } } function stateChange() { if (xmlhttp.readyState==4) {// 4 = "loaded" if (xmlhttp.status==200) {// 200 = "OK" document.getElementById('KM_Range').innerHTML=xmlhttp.responseXML; } else { alert("Problem retrieving data:" + xmlhttp.statusText); } } }
Thanks
Paul Clapham
Marshal
Posts: 28193
95
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
This question seems to be about Javascript. Let's move it to a more suitable forum.
Don't get me started about those stupid
light bulbs
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
How to display XML documents using JSP?
parsing the xml returned from ajax call
AJAX 'POST' xml request to server
Does Tomcat send content-type using a strange format in header? (Can I change this?)
Can I used XML tag inside Servlets?
More...