[英]JSON_2_Region.json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
I am developing the mobile application using ADT there and I am facing error 我在那里使用ADT开发移动应用程序,但遇到错误
"No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access."
“所请求的资源上没有'Access-Control-Allow-Origin'标头。因此,不允许访问源'null'。”
while my code reads from the path testapp/assets/www/Pages/JSON_2_Region.json
而我的代码从路径
testapp/assets/www/Pages/JSON_2_Region.json
Here is my code: 这是我的代码:
$.getJSON('JSON_2_Region.json', function (data) {
$('#List_Region_Details').empty();
$('#JSON_2_Region li').remove();
region_list = data.JSON_MAS_Data_Region;
$.each(region_list, function (index, JSON_MAS_Data_Region) {
$('#List_Region_Details').append('<li><a href="" data-id="' + JSON_MAS_Data_Region.Region_ID + '">' + JSON_MAS_Data_Region.Region_Name + '</a></li>');
});
$('#List_Region_Details').listview('refresh');
});
The error happens only in the Chrome browser when I copy/paste the url seperately but works fine in my ADT default browser and emulator. 当我分别复制/粘贴URL时,该错误仅在Chrome浏览器中发生,但在我的ADT默认浏览器和模拟器中可以正常工作。
If you want to testing using your browser, you need to use ripple chrome extension to run in mobile environment. 如果要使用浏览器进行测试,则需要使用波纹镀铬扩展程序才能在移动环境中运行。 You will got this error message if you not run the app in mobile environment.
如果您不在移动环境中运行应用程序,则会收到此错误消息。
Uncaught ReferenceError: cordova is not defined
https://chrome.google.com/webstore/detail/ripple-emulator-beta/geelfhphabnejjhdalkjhgipohgpdnoc?hl=en https://chrome.google.com/webstore/detail/ripple-emulator-beta/geelfhphabnejjhdalkjhgipohgpdnoc?hl=zh-CN
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.