Can AJAX request data from a remote server?

You need to use a method that is called as JSONP.

One of the best ways is to use jQuery to reduce the code and worries between your page and the server, and all you need to do is:

$.ajax({
  dataType: 'jsonp',
  data: 'id=10',
  jsonp: 'jsonp_callback',
  url: 'http://myotherserver.com/getdata',
  success: function () {
    // do stuff
  },
});

Leave a Comment