Using GoodForms using AMD (Asynchronous Module Definition) or Require.js

Created by Alison Gianotto, Modified on Wed, 17 Dec, 2025 at 2:42 PM by Brady Wetherington

Here’s an example of consuming the API by using Require.js:


<html>
<br>
<script src='/require.js'></script>
<form>
<input name='email'><br>
<input type='submit'>
</form>
<script>
// Yes, this is actually an AMD usage of the library, and is correct, and uses Require.js
require(['https://unpkg.com/goodforms@0.9.2'], function(goodforms) {
    // Configuration loaded now, safe to do other require calls
    // that depend on that config.
    goodforms('your_form_key', {debug: true})

    require(['foo'], function(foo) {
        
    });
});
</script>
</html>


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article