Skip to content

Instantly share code, notes, and snippets.

@samcorcos
Last active May 31, 2016 08:26
Show Gist options
  • Save samcorcos/35c1d26633db7e993df296116be9b8c1 to your computer and use it in GitHub Desktop.
Save samcorcos/35c1d26633db7e993df296116be9b8c1 to your computer and use it in GitHub Desktop.
index.html part 1 for payment processor
<html>
<head>
<title>Page Title</title>
<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
</script>
<script>
var submit = function() {
$.ajax({
type: 'POST', url: '/api/purchase', data: {
token: "stripe-token"
},
beforeSend: function (xhr) {
xhr.setRequestHeader ("Authorization", "true");
},
}).done(function(res) {
console.log(res)
console.log("POST request successful");
})
}
</script>
</head>
<body>
Hello World!
<button onclick="submit()">submit</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment