0
$scope.readFile = function(url){

    var doc = new XMLHttpRequest();
    doc.onreadystatechange = function() {
        if (doc.readyState == XMLHttpRequest.DONE) {
            if (doc.responseText == undefined)
                return;
            $scope.loglines += doc.responseText;
        }
    }
    doc.open("GET", url, true);


    doc.send();
}

this is the code i used to get data from same origin using angularJS. how could i impore this to get data fron cross domain

1 Answers1

0

To get data from cross domain, you can't do anything on client side, however you can set CORS on server side so that server allows you to send a cross origin request.

One other bad solution is to disable chrome same origin policy.

Disable same origin policy in Chrome

Community
  • 1
  • 1
Zohaib Ijaz
  • 21,926
  • 7
  • 38
  • 60