I call the api using this:
$.ajax({
contentType: "text/html; charset=utf-8",
dataType: "jsonp",
type: "get",
crossDomain: true,
url: "http://data.nba.com/data/10s/html/nbacom/2013/gameinfo/20140501/0041300106_boxscore_csi.html",
success: function (val) {
$(".content-wrapper").text(val);
var a = val;
}
})
I get the error:
Resource interpreted as Script but transferred with MIME type text/html:
which i read is not realy an error but a warning. If i paste the url in the domain it shows the return in a textarea. And if i try to debugg the code using chrome it wont reach the success but instead say:
Uncaught SyntaxError: Unexpected token <
How can i get the html straight into my own html so that i shows the table that the call returns?
Try changing your datatype to 'html'
I believe you are using dataType and contents type incorrectly. Try switching dataType
to text/html
.
if the response is HTML you should change the ajax success to:
success: function (val) {
$(".content-wrapper").html(val);
...
Hope this helps!