Skip to content

Instantly share code, notes, and snippets.

@b13bs
Created May 28, 2018 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save b13bs/a763fcf194d9299488f2a8a290786f42 to your computer and use it in GitHub Desktop.
Save b13bs/a763fcf194d9299488f2a8a290786f42 to your computer and use it in GitHub Desktop.
CORS snippets
var script = document.createElement('script');script.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js";document.getElementsByTagName('head')[0].appendChild(script);
$.ajax({
url: "https://fullurl-api.test",
type: "OPTIONS",
complete: function(result, status) {
console.log(status)
console.log(result)
}
});
$.ajax({
url: "https://fullurl-api.test",
type: "GET",
data: "param=value",
complete: function(result, status) {
console.log(status)
console.log(result)
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment