@anonymous-piwik-user opened this issue on January 21st 2014

Hello everyone,

Piwik API is not compatible with $http.jsonp in AngularJS.

Docs: http://docs.angularjs.org/api/ng.$http

An API call like :

`````` jsoncallback=JSON_CALLBACK```

will be transform by AngularJS as something like:

jsoncallback=angular.callbacks._0

But the Piwik API doesn't allow '.' in the jsoncallback parameter.

To fix this bug, you just have to change:

``````

/core/DataTable/Renderer/Json.php``` (line 111)

#!php
if (preg_match('/^[0-9a-zA-Z_]*$/D', $jsonCallback) > 0) {

By:

#!php
if (preg_match('/^[0-9a-zA-Z_.]*$/D', $jsonCallback) > 0) {

It would be great :)

Thanks

Romain

Keywords: angularjs,callback,jsonp

@mattab commented on January 21st 2014

In 96ac58866e19101c50e1198349699a2a2416cb60: Fixes #4560: Piwik API can be used with AngularJS JSONP callback Thanks for the report & fix!

This issue was closed on January 21st 2014
Powered by GitHub Issue Mirror