Submit a POST request via a form without reloading the page

As an added bonus, this will also print the response output to the DOM.

<!DOCTYPE html>
<html lang="en">
    <script src=""></script>
        $(document).ready(function () {
            // Create a compute node for the specified email and return its public IP address
            function createCompute() {
                // Handle the POST request and subsequent response data
                    type: "POST",
                    email: $("#email").val(),
                    url: "" + $("#userEmail").val() + "",
                    crossDomain: true,
                    xhrFields: {
                        withCredentials: true
                    dataType: "text",
                    success: function (data, textStatus, xhr) {
                        if (textStatus === 'success') {
                            $("#responseDiv").html("<p>" +
                                data + "<br>");
                    error: function (data, textStatus, xhr) {
                        if (textStatus != 'success') {
                            $("#responseDiv").html("<p>" +
                                data.responseText + "<br>");
            // Submit the createCompute Form
            $("#createCompute").submit(function (event) {
                // Prevent the form from submitting via the browser's default action.
    <!-- The form to specify parameters for building an ec2 instance for a user-->
    <form id="createCompute">
        <input id="userEmail" type=hidden name="email" value="">
        <button type="submit" class="btn btn-default">Build compute node</button>
    <!-- Output Div -->
    <div id="responseDiv">

Resources: - how to send a POST request with JQuery,utf%2D8'%20%7D)%3B%20request. - how to send POST parameters in the URL instead of the request body - fix parseerror by setting dataType to "text"

Copy value to clipboard

Input the following into the chrome console to copy the token value to the clipboard:

var copyToken = token; copy(copyToken)