Skip to content

Instantly share code, notes, and snippets.

@jbrunemann
Created December 8, 2014 11:15
Show Gist options
  • Save jbrunemann/a2c57809c30c7cfa65cc to your computer and use it in GitHub Desktop.
Save jbrunemann/a2c57809c30c7cfa65cc to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
$(document).ready(function () {
var variables = {
username: "abc",
password: "xyz"
};
var jsonString = JSON.stringify(variables);
// This one is essential for IE8!
$.support.cors = true;
$.ajax({
type: "POST",
url: "https://sandbox.api.cso20.net/v1/JobAPI/getApiKey.json",
data: {args: jsonString},
dataType: "json"
}).done(function (data) {
$("h2").text(data.result);
}).fail(function (jqXHR, textStatus, errorThrown) {
$("h2").text(textStatus);
});
});
</script>
</head>
<body>
<h2></h2>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment