Hi all,
I'm developing a panel where there are quick Piwik statistics, now the problem is that Piwik is installed into server 1 and the other application is installed in local. When i attempt to use the API provided by Piwik with a jquery script it show CORSS error.
I tried this [piwik.org] but nothing changed.
The jquery script.
The error returned by jquery script.
What i have to do to avoid it?
Thanks in advance have a nice day, Byee.
I'm developing a panel where there are quick Piwik statistics, now the problem is that Piwik is installed into server 1 and the other application is installed in local. When i attempt to use the API provided by Piwik with a jquery script it show CORSS error.
I tried this [piwik.org] but nothing changed.
The jquery script.
$.ajax({ url: 'http://www.andreacatania.com/piwik/index.php', data: { module: 'API' , method: 'Actions.getPageUrl' , idSite: 1 , period: 'range' , date: 'last7' , pageUrl: pageUrl , format: 'json' , token_auth: '7917f2596f8bb70c954893f200ba6274' , crossDomain: true }, type: 'get', dataType: 'json', success: function( data ){ alert( data.sum_daily_entry_nb_uniq_visitors ); }, error: function(response, ajaxOptions, thrownError) { console.log( ajaxOptions + ': ' + thrownError ); } });
The error returned by jquery script.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://www.andreacatania.com/piwik/index.php?module=API&method=Actions.getPageUrl&idSite=1&period=range&date=last7&pageUrl=%2Fcpumper%2Ftest&format=json&token_auth=7917f2596f8bb70c954893f200ba6274&crossDomain=true. This can be fixed by moving the resource to the same domain or enabling CORS.
What i have to do to avoid it?
Thanks in advance have a nice day, Byee.