I am creating a charting application for android version. And i am using highcharts for that purpose.

My Problem is: How to access local .json file in jsp page.

I already try the following line of code but i don't know why it was not working in android, same is working with web application.

$.getJSON('column_data.json', function(data){...

And i am getting the following error:

XMLHttpRequest cannot load file:///android_asset/www/aapl_data.json. Origin null is not allowed by Access-Control-Allow-Origin. at null:1

Can any body help me to get out this problem.

Json file content following type data:

[
[1147651200000,18921051],
[1147737600000,33470860],
[1147824000000,26941146],
[1147910400000,23524811],
[1147996800000,35221586],
[1148256000000,25680800],
[1148342400000,24814061],
[1148428800000,32722949],
[1148515200000,16563319],
[1148601600000,15464811],
[1148947200000,20125338],
[1149033600000,45755325]
]
有帮助吗?

解决方案

The error means that you cannot load file from local storage (security politics), only from webserver.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top