0

I am creating amcharts graph on ASP.net website. I have hosted a josn file in my localhost and IIS server is running. but graph always display as "Loading data..."

here my Javascript function.

   AmCharts.ready(function () {

        var chart = new AmCharts.AmSerialChart();
        chart.dataLoader = {
            url: "http://localhost:1080/JSON/emp_info.json",
            postProcess: function (data, options) {
                if (data === null) {
                    data = [];
                    options.chart.addLabel("50%", "50%", "No Data Available");
                }
                return data;
            }
        };

        chart.categoryField = "employee_no";


        var graph = new AmCharts.AmGraph();
        graph.valueField = "Salary";
        graph.type = "line";
        graph.bullet = "round";
        graph.lineColor = "#8d1cc6";

        chart.addGraph(graph);

        chart.write('chartdiv');

    });

Google chrome gives following error.

XMLHttpRequest cannot load http://localhost:1080/JSON/emp_info.json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:59062' is therefore not allowed access.

How can I solve this issue ?

Keey
  • 23
  • 1
  • 1
  • 5
  • 1
    duplicate of http://stackoverflow.com/questions/20442628/cors-jquery-ajax-request – Lucius Oct 22 '15 at 08:06
  • Possible duplicate of ["No 'Access-Control-Allow-Origin' header is present on the requested resource"](http://stackoverflow.com/questions/20035101/no-access-control-allow-origin-header-is-present-on-the-requested-resource) – Anoop B.K Dec 01 '15 at 06:30

0 Answers0