# Axios

Axios (opens new window) is an promise based HTTP client for the browser and node.js, it's lightweight and a common library for making HTTP requests.

You can also Axios to submit your forms to Getform.

# Simple Axios Setup

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Getform | AJAX with Axios</title>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
  </head>
  <body>
    <script>
      axios
        .post("https://getform.io/f/{your-form-endpoint}", {
          message: "Hello, World",
        })
        .then(response => console.log(response))
        .catch(error => console.log(error))
    </script>
  </body>
</html>

# Axios with reCaptcha v2

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Getform | Axios using reCAPTCHA v2</title>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <script src="https://www.google.com/recaptcha/api.js"></script>
  </head>
  <body>
    <div class="g-recaptcha" data-sitekey="your-site-key"></div>
    <button id="send-button" type="button">Send</button>
    <script>
      document
        .getElementById("send-button")
        .addEventListener("click", function () {
          axios
            .post("https://getform.io/f/{your-form-endpoint}", {
              message: "Hello, World",
              "g-recaptcha-response": grecaptcha.getResponse(),
            })
            .then(function (response) {
              console.log(response);
            })
            .catch(function (response) {
              console.error(response);
            });
        });
    </script>
  </body>
</html>

INFO

Axios Support is available on Start and Grow plans (opens new window).