mercredi 14 mai 2014

Why parsing JSON in firefox doesn't work


Vote count:

0




I'm bumping my head for a long time and i googled a lot but i can't find a solution, i hope someone can explain to me why this code is working without problems in Chrome, meanwhile in Firefox/Safari i get a bunch of errors.


Here is what i did:



getJSON = function(url, successHandler, errorHandler){

var xhr = new XMLHttpRequest();
xhr.open('get', url, true);
xhr.responseType = 'json';

xhr.onload = function(){
var status = xhr.status;
if (status == 200) {
successHandler && successHandler(xhr.response);
chartLoad(xhr.response)
} else {
errorHandler && errorHandler(status);
}
};

xhr.send();
};


An then:



function chartLoad(data){
chart = AmCharts.makeChart("graph", {
...
dataProvider: data,
...
});
};

getJSON('/test/json');


In console i get:


Unexpected value NaN parsing width attribute.


Unexpected value NaN parsing x attribute.


Unexpected value translate(NaN,0) parsing transform attribute.



asked 1 min ago

Jack

39





Aucun commentaire:

Enregistrer un commentaire