Reputation: 6263
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: 1844
Reputation: 82554
Use responseText
instead of responseXML
xmlhttp=new XMLHttpRequest();
xmlhttp.open("GET","http://example.com",false);
xmlhttp.send();
data = xmlhttp.responseText;
Upvotes: 4