1

I am currently trying to get data from a remote url using jQuery ajax calls.

I am just using a basic jquery function to do this. When using a local file the functions works correctly but it does not get a remote file.

I'm using the local files using Mamp on my local pc.

$.ajax({
url: "URL",
success: function(data) {
    $('#notification').html(data);
}
});

Any ideas why this may not be work would be a great help?

Thanks, Kane

Kane Mitchell
  • 370
  • 2
  • 4
  • 12

3 Answers3

4

Sounds like Same origin policy. You might need to use JSONP.

graphicdivine
  • 10,937
  • 7
  • 33
  • 59
1

when you say 'remote file' do you mean like from another domain? coz browsers typically don't allow that.

See this JQuery external Ajax call not working in IE

Community
  • 1
  • 1
rgin
  • 2,291
  • 4
  • 24
  • 32
1

Cross domain ajax request is not allowed typically. You can take a look to these answers:

jQuery AJAX cross domain

problem with cross-domain ajax calls

Community
  • 1
  • 1
Nevin
  • 7,689
  • 1
  • 23
  • 25