Skip to content

Instantly share code, notes, and snippets.

@m-philipp
Created February 18, 2014 03:38
Show Gist options
  • Select an option

  • Save m-philipp/9064268 to your computer and use it in GitHub Desktop.

Select an option

Save m-philipp/9064268 to your computer and use it in GitHub Desktop.
CORS Jquery Test
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>get demo</title>
<style>
span {
color: red;
}
div {
background: yellow;
}
</style>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<script>
// Assign handlers immediately after making the request,
// and remember the jqXHR object for this request
var jqxhr = $.ajax({ url: "http://www.api.lean2do.de/version",
type: "GET",
crossDomain: true})
.done(function() {
alert( "success" );
})
.fail(function() {
alert( "error" );
})
.always(function() {
alert( "complete" );
});
// Perform other work here ...
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment