Thanks @Human love for the tip. Achived what I wanted by trying this way. Moved my flurry url to php and requested service from there. Then encoded the result in to json. It giving same errors if you didn't set the headers properly.
Server side code:
header('Content-type: application/json');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, Authorization, X-Request-With');
header('Access-Control-Allow-Credentials: true');
$url="http://api.flurry.com/appMetrics/ActiveUsersByMonth?apiAccessCode=DXGSYSYBSK26BZNSJB2X&apiKey=Removed&startDate=2012-01-01&endDate=2012-12-30&country=LK&versionName=1.0&groupBy=MONTHS";
$json=file_get_contents($url);
echo $json;
Client side jquery ajax:
$.ajax({
type: "GET",
url: "<?php echo base_url("frontpage/monthly_active_count"); ?>"
})
.done(function( data ) {
console.log(data);
var activeUsers = [];
$.each( data.day, function( i, item ) {
var arr = $.map(item, function(el) { return el; });
activeUsers.push(arr[1]);
});
var barChartData = {
labels : ["January","February","March","April","May","June","July","August","September","October","November","December"],
datasets : [
{
fillColor : "rgba(220,220,220,0.5)",
strokeColor : "rgba(220,220,220,0.8)",
highlightFill: "rgba(220,220,220,0.75)",
highlightStroke: "rgba(220,220,220,1)",
data : activeUsers
}
]
}
var myChart = new Chart(document.getElementById("canvas").getContext("2d")).Bar(barChartData, {
responsive : true
});
});