Rakshazi
Rakshazi

Reputation: 75

jQuery.get - how to get text instead of html?

I have following code to get data from other site:

jQuery.ajaxSetup({
    crossDomain: true,
    dataType: "jsonp text"
});
jQuery.get(url, function(rawContent) {
    console.log(rawContent);
});

But I got a error: "Syntax error" from jQuery, becouse target site use following doctype:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

How can I get text by this query instead of html?

Upvotes: 0

Views: 89

Answers (1)

Quentin
Quentin

Reputation: 944217

dataType: "jsonp text" is telling it to parse a response as JSONP and then convert it to text. The The response you describe is not JSONP.

Just use dataType: "text".

Upvotes: 3

Related Questions