Hello, folks, I hope someone could help me find out:
I'm using jQuery's $.ajax to query piwik, JSONp way.
K, let's query piwik.
my query now looks like this ( &jsoncallback=foo had been append )
So far, so good.
BUT piwik outputs the callback wrong place:
Answer:
I expected:
thus chrome throws a
Am I missing something here?
Thank you for your kind attention.
I'm using jQuery's $.ajax to query piwik, JSONp way.
https://PIWIK_HOST/?module=API&format=JSON&token_auth=XXX&[my_Query_Parameters]my JS looks like this:
$.ajaxSetup({ scriptCharset: "UTF-8" , contentType: "application/json; charset=UTF-8", type:"GET" }); $.ajax({ url:Query, crossDomain:true, dataType : 'jsonp', jsonp : 'jsoncallback', jsonpCallback : 'foo', success : function(json_data){ document.write(json_data); }, error : function(){ console.log("ERRRRR!"); }, statusCode: { 403: function() { console.log("403"); }, 404: function() { console.log("404"); }, 500: function() { console.log("Hamster"); } } });
K, let's query piwik.
my query now looks like this ( &jsoncallback=foo had been append )
https://PIWIK_HOST/?module=API&format=JSON&token_auth=XXX&[my_Query_Parameters]&jsoncallback=foo
So far, so good.
BUT piwik outputs the callback wrong place:
Answer:
{"date":"XXX","previousPages":foo([{"label":"XXX ...
I expected:
foo{"date":"XXX","previousPages":[{"label":"XXX ...
thus chrome throws a
Uncaught SyntaxError: Unexpected token : index.php line 1
Am I missing something here?
Thank you for your kind attention.