Skip to content

Instantly share code, notes, and snippets.

@leohxj
Created September 20, 2016 15:28
Show Gist options
  • Save leohxj/a6256b5a9acd170629b12ca391ed1f09 to your computer and use it in GitHub Desktop.
Save leohxj/a6256b5a9acd170629b12ca391ed1f09 to your computer and use it in GitHub Desktop.
Ajax CORS
// Zepto CORS
$.ajax({
type: "get",
url: url,
data: data,
xhrFields: {
withCredentials: true
},
crossDomain: true,
beforeSend: function() {
console.log("beforeSend");
},
success: function(data) {
console.log("success");
},
error: function() {
console.log("error");
},
complete: function() {
console.log("complete");
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment