Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!doctype html>
<html lang="en">
<head>
  <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
  <title>Zipwhip Message Send API Example</title>
</head>
<body>
  
<div class="p-3">
  <h2>Zipwhip Message/Send API</h2>
  <p><a href="https://developers.zipwhip.com" target="_blank">developers.zipwhip.com</a></p>
</div>

<!-- Form for logging into Zipwhip  -->
<form class="border p-4 bg-light" action="https://api.zipwhip.com/user/login" method="POST">
    <div class="form-group">
        <label for="username">Username:</label>
        <input type="text" class="form-control" id="username" value="">
    </div>
    <div class="form-group">
        <label for="password">Password:</label>
        <input type="password" class="form-control" id="password" value="">
    </div>
    <input type="submit" class="btn btn-primary" id="submit" value="Submit">
</form>


<!-- Display Success or Failer Message after Submit -->
<div id="success-alert" class="mt-3 alert alert-success alert-dismissible" style="display:none;">
    <button id="close-alert" type="button" class="close">&times;</button>
    <strong>Login Successful</strong>
</div>

<div id="failed-alert" class="mt-3 alert alert-danger alert-dismissible" style="display:none;">
    <button id="close-alert" type="button" class="close">&times;</button>
    <strong>Login Failed</strong>
</div>

<!-- Display JSON response after Submit-->
<div id="json-response" class="d-none py-4 border-bottom">
  <h3>Response</h3>
  <pre>
    <code class="language-json" id="api-response">
    </code>
  </pre>
</div>

</body>
</html>
              
            
!

CSS

              
                
              
            
!

JS

              
                $(document).ready(function() {
    $("#submit").click(function(event) {
        $("#submit").attr("disabled", true);
        $('.alert').hide();
        event.preventDefault();
        username = $("#username").val()
        password = $("#password").val()
        console.log("username: " + username);
        $.post("https://api.zipwhip.com/user/login", {
                    username: username,
                    password: password
                },
                // Store cookie
                function(response, status) {
                    if (response.success == true) {
                        $('#success-alert').fadeIn("slow");
                    } else {
                        alert(response.response);
                    };
                })
            .fail(function(response) {
                $('#failed-alert').fadeIn("slow");
            })
            .always(function(response) {
                displayJsonResponse(response);
                $("#submit").attr("disabled", false);
            });
    });
});

// Display syntax highlighted json results
function displayJsonResponse(response) {
    $("#api-response").ready(function() {
        if ($("#api-response").length) {
            $("#api-response").text(status + '\n' + JSON.stringify(response, undefined, 2));
            $("#json-response").hide();
            $("#json-response").removeClass("d-none");
            $("#json-response").fadeIn("slow");
            Prism.highlightElement($('#api-response')[0]);
        };
    });
}

              
            
!
999px

Console