Skip to content

Instantly share code, notes, and snippets.

@mgroves
Created May 26, 2014 15:17
Show Gist options
  • Select an option

  • Save mgroves/43e04925cb084589ced5 to your computer and use it in GitHub Desktop.

Select an option

Save mgroves/43e04925cb084589ced5 to your computer and use it in GitHub Desktop.
$(document).ready(function() {
$.ajax({
type: "GET",
url: "http://www.google.com",
dataType: 'json',
crossDomain: true // forcing a cross domain request for demonstration, you can omit this
})
.done(function(content) {
console.log(content);
});
});
// should result in error message:
// XMLHttpRequest cannot load http://www.google.com/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment