0

I'm new at RESTFul requests sending, I tried a simple request to W3Schools "http://www.w3schools.com/website/customers_mysql.php" and it returned successfully, then I tried this link using this:

  try {
        var secondReqest = new XMLHttpRequest();
        secondReqest.open("GET", "http://rest-service.guides.spring.io/greeting", false);
        secondReqest.send();
        alert('second reqest sent');
        alert(secondReqest.status);
        alert(secondReqest.statusText);
    } catch (e) {
        alert(e);
    }

but I'm getting this message: NetworkError: failed to execute 'send' on 'xmlhttprequest' failed to load ' http: //rest-service.guides.spring.io/greeting'.

I tried launching chrome with allow-file-access-from-files but it didn't help..

any help why this is happening?, and how to fix it?

Boda
  • 329
  • 2
  • 11
  • Is that the complete error message? – Quentin Jan 14 '16 at 12:00
  • Look at your browsers developer tools console. It says: XMLHttpRequest cannot load http://rest-service.guides.spring.io/greeting. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://null.jsbin.com' is therefore not allowed access. – Quentin Jan 14 '16 at 12:01

0 Answers0