0

Is it possible to get a response from another domain through Ajax?

I used the below code to get the some records from another domain, but it doesn't works, Is it is possible by Ajax or How can I?

$.ajax({
    url: 'http://www.anotherdomain.com',
    type: 'GET',
    data: {
        user: 123
    },
    success: function(response) {
        alert(response);
    }
});
Mani
  • 2,675
  • 2
  • 20
  • 42
  • 2
    Yes, but does the domain allow Cross-Origin Requests? Learn more about [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS) and how to [enable CORS](https://enable-cors.org/), if you own the domain. Check the **console** for any errors that you could see and please share it with us. – Praveen Kumar Purushothaman Apr 20 '17 at 10:49
  • 1
    depends on the domain – madalinivascu Apr 20 '17 at 10:49

0 Answers0