1

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()

1 Answer 1

4

Use responseText instead of responseXML

xmlhttp=new XMLHttpRequest();
xmlhttp.open("GET","http://example.com",false);
xmlhttp.send();
data = xmlhttp.responseText;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.