Skip to content

Instantly share code, notes, and snippets.

@naush
Last active August 29, 2015 13:57
Show Gist options
  • Save naush/9523270 to your computer and use it in GitHub Desktop.
Save naush/9523270 to your computer and use it in GitHub Desktop.
CORS Example
$.ajaxSetup({
dataType: "json",
beforeSend: function(xhr) {
xhr.setRequestHeader("accept", "application/json");
}
});
$.fetchJSON = function(path) {
return $.ajax({
url: path,
type: "GET",
contentType: "application/json; charset=UTF-8"
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment