JSONP Callback and piwik API

Hello, folks, I hope someone could help me find out:
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":[b]foo[/b]([{"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.

maybe there’s a bug for that particular API for jsonp, we don’t really test it or use this feature at present.

Try with others API if you see a problem please post here example URLs with the demo.piwik.org server, thanks

K thanks for pointing that out.
I was just going mad staring at the same code with no luck.
I tried with a different API.Method and that works great.

There’s a bug in JSON API.Method [ Transitions.getTransitionsForAction ]

Thank you for you quick response.