0

Hi i have created an html page with this javascript function

           function getData() {
                if(window.XMLHttpRequest) {
                    req = new XMLHttpRequest();
                    req.onreadystatechange=sendData;
                    req.open("GET", "http://service-page/axis2Example-1.0.0-SNAPSHOT/services/SystemService/viewUsers?positionX=10&positionY=30&round=10", true);
                    req.send();
                }
            }

            function sendData() {
                if(req.readyState==4 & req.status==200) {

            }
        }

This function is used to call a web service. The problem is that my browser answer with this message:

XMLHttpRequest cannot load ........ autoCreate=false&log=true. Origin ...... is not allowed by Access-Control-Allow-Origin.

Does anyone knows a solution?

4

1 回答 1

0

您必须在您的 ajax 目标服务器中启用 CORS(跨域资源共享)。

你可以在这里找到更多信息 http://enable-cors.org/server.html

于 2013-09-05T19:29:54.977 回答