简体   繁体   English

JSON_2_Region.json。 所请求的资源上没有“ Access-Control-Allow-Origin”标头。 因此,不允许访问原始“空”。

[英]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.

相关问题 ionic:请求的资源上不存在“ Access-Control-Allow-Origin”标头 - ionic: No 'Access-Control-Allow-Origin' header is present on the requested resource 模型查看器颤动请求的资源上不存在“Access-Control-Allow-Origin”标头 - modelviewer flutter No 'Access-Control-Allow-Origin' header is present on the requested resource Android WebView“请求的资源上不存在&#39;Access-Control-Allow-Origin&#39;标头” - Android WebView “No 'Access-Control-Allow-Origin' header is present on the requested resource” WebView不存在“ Access-Control-Allow-Origin”标头[ANDROID] - WebView No 'Access-Control-Allow-Origin' header is present [ANDROID] Access-Control-Allow-Origin不允许使用Origin null(从android获取XML) - Origin null is not allowed by Access-Control-Allow-Origin (get XML from android) Google Cast:加载元数据错误并且不存在Access-Control-Allow-Origin标头 - Google Cast: Load Metadata Error and No Access-Control-Allow-Origin header is present Heroku上的Meteor移动服务器-不存在Access-Control-Allow-Origin标头 - Meteor Mobile Server on Heroku - No Access-Control-Allow-Origin header is present webview-访问控制允许原点不允许原点(使用cordova将angular转换为mobile) - webview - origin is not allowed by access-control-allow-origin (convert angular to mobile using cordova) android webview - 访问控制允许来源 - android webview - Access-Control-Allow-Origin Angular 无“访问控制允许来源” - Angular No 'Access-Control-Allow-Origin'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM