<small id='g8exG'></small><noframes id='g8exG'>

    1. <tfoot id='g8exG'></tfoot><legend id='g8exG'><style id='g8exG'><dir id='g8exG'><q id='g8exG'></q></dir></style></legend>
      <i id='g8exG'><tr id='g8exG'><dt id='g8exG'><q id='g8exG'><span id='g8exG'><b id='g8exG'><form id='g8exG'><ins id='g8exG'></ins><ul id='g8exG'></ul><sub id='g8exG'></sub></form><legend id='g8exG'></legend><bdo id='g8exG'><pre id='g8exG'><center id='g8exG'></center></pre></bdo></b><th id='g8exG'></th></span></q></dt></tr></i><div id='g8exG'><tfoot id='g8exG'></tfoot><dl id='g8exG'><fieldset id='g8exG'></fieldset></dl></div>

        <bdo id='g8exG'></bdo><ul id='g8exG'></ul>
      1. 请求的资源上没有“Access-Control-Allow-Origin"标

        时间:2023-09-03
        <i id='KUkAE'><tr id='KUkAE'><dt id='KUkAE'><q id='KUkAE'><span id='KUkAE'><b id='KUkAE'><form id='KUkAE'><ins id='KUkAE'></ins><ul id='KUkAE'></ul><sub id='KUkAE'></sub></form><legend id='KUkAE'></legend><bdo id='KUkAE'><pre id='KUkAE'><center id='KUkAE'></center></pre></bdo></b><th id='KUkAE'></th></span></q></dt></tr></i><div id='KUkAE'><tfoot id='KUkAE'></tfoot><dl id='KUkAE'><fieldset id='KUkAE'></fieldset></dl></div>

          <tfoot id='KUkAE'></tfoot>
          <legend id='KUkAE'><style id='KUkAE'><dir id='KUkAE'><q id='KUkAE'></q></dir></style></legend>
              <tbody id='KUkAE'></tbody>

          1. <small id='KUkAE'></small><noframes id='KUkAE'>

                • <bdo id='KUkAE'></bdo><ul id='KUkAE'></ul>
                  本文介绍了请求的资源上没有“Access-Control-Allow-Origin"标头-AngularJS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  XMLHttpRequest cannot load http://mywebservice. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9000' is therefore not allowed access.
                  

                  当我尝试从我的代码中运行我的网络服务时,我收到了这个错误.我试图找到它并尝试了许多我在网上找到的建议的解决方案.粘贴下面的代码.

                  I get this error when I try to run my web-service from inside my code. I tried finding about it and tried many solutions which were suggested which I found on net. Pasting the code below.

                  <form name="LoginForm" ng-controller="LoginCtrl" ng-submit="init(username,password,country)">
                      <label>Country</label><input type="text" ng-model="country"/><br/><br/>
                      <label>UserName</label><input type="text" ng-model="username" /></br></br>
                      <label>Password</label><input type="password" ng-model="password">
                      </br>
                      <button type="submit" >Login</button>
                  </form>
                  

                  和controller form对应的js是:

                  And controller form the corresponding js is:

                  app.controller('LoginController', ['$http', '$scope', function ($scope, $http) {
                      $scope.login = function (credentials) {
                      $http.get('http://mywebservice').success(function ( data ) {
                          alert(data);
                          });
                      }
                  }]);
                  

                  当我从 URL 栏中点击它时,网络服务工作正常.如何解决问题?请帮忙!

                  The web-service works fine when I hit it from URL bar. How to resolve the problem? Kindly help!

                  推荐答案

                  Chrome Webstore 有一个扩展,当存在异步时会为您添加Access-Control-Allow-Origin"标头调用试图访问与您不同的主机的页面.

                  The Chrome Webstore has an extension that adds the 'Access-Control-Allow-Origin' header for you when there is an asynchronous call in the page that tries to access a different host than yours.

                  扩展名是:Allow-Control-Allow-Origin: *",这是链接:https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi

                  The name of the extension is: "Allow-Control-Allow-Origin: *" and this is the link: https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi

                  这篇关于请求的资源上没有“Access-Control-Allow-Origin"标头-AngularJS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:CORS - 它是客户端的东西,服务器端的东西,还是 下一篇:从 React(同构应用程序)进行 API 调用时出现“Acc

                  相关文章

                  最新文章

                  <legend id='f2PiD'><style id='f2PiD'><dir id='f2PiD'><q id='f2PiD'></q></dir></style></legend>

                  <small id='f2PiD'></small><noframes id='f2PiD'>

                  <i id='f2PiD'><tr id='f2PiD'><dt id='f2PiD'><q id='f2PiD'><span id='f2PiD'><b id='f2PiD'><form id='f2PiD'><ins id='f2PiD'></ins><ul id='f2PiD'></ul><sub id='f2PiD'></sub></form><legend id='f2PiD'></legend><bdo id='f2PiD'><pre id='f2PiD'><center id='f2PiD'></center></pre></bdo></b><th id='f2PiD'></th></span></q></dt></tr></i><div id='f2PiD'><tfoot id='f2PiD'></tfoot><dl id='f2PiD'><fieldset id='f2PiD'></fieldset></dl></div>

                        <bdo id='f2PiD'></bdo><ul id='f2PiD'></ul>

                    1. <tfoot id='f2PiD'></tfoot>