Skip to content

Instantly share code, notes, and snippets.

@adam704a
Created October 7, 2020 15:05
Show Gist options
  • Save adam704a/bf432183711db6a259b14a9df73fef1f to your computer and use it in GitHub Desktop.
Save adam704a/bf432183711db6a259b14a9df73fef1f to your computer and use it in GitHub Desktop.
CORS test
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script
src="https://code.jquery.com/jquery-3.5.1.min.js"
integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0="
crossorigin="anonymous"></script>
<title>Title</title>
</head>
<body>
<script>
$.ajax
({
type: "GET",
url: "https://play.dhis2.org/2.34.1/api/me",
headers: {
"Authorization": "Basic " + btoa("admin" + ":" + "district")
},
success: function (data) {
console.log(data);
}
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment