Reputation: 6313
I am using some AJAX like this:
xmlhttp=new XMLHttpRequest();
xmlhttp.open("GET","http://example.com",false);
xmlhttp.send();
data = xmlhttp.responseXML;
The xmlhttp.responseXML is returned in XML, so it's a javascript object. However, I would like it in raw string format. Something akin to setting dataType: "text"
in jQuery's $.ajax()
Upvotes: 1
Views: 1845
Reputation: 82654
Use responseText
instead of responseXML
xmlhttp=new XMLHttpRequest();
xmlhttp.open("GET","http://example.com",false);
xmlhttp.send();
data = xmlhttp.responseText;
Upvotes: 4