Skip to content

Instantly share code, notes, and snippets.

@josephj
Created March 7, 2013 06:37
Show Gist options
  • Save josephj/5105989 to your computer and use it in GitHub Desktop.
Save josephj/5105989 to your computer and use it in GitHub Desktop.
Cross-domain testing.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>XMLHttpRequest Cross Domain</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<style type="text/css">
</style>
</head>
<body>
<div>
</div>
<script>
$.ajax({
type: "GET",
url: "http://106.187.98.37/2013/ajax-crossdomain/ajax.txt",
timeout: 2000,
dataType: "json",
success: function (o) {
alert("[SUCCESS] Message = " + o.message);
},
error: function (o) {
alert("[ERROR] Error Status = " + o.status);
}
});
</script>
</body>
</html>
@josephj
Copy link
Author

josephj commented Mar 7, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment