How can I close the popup when a Ninja Form is successfully submitted?

To automatically close your FireBox campaign whenever the Ninja Form that’s embedded into your popup is submitted successfully, please go into your campaign > Advanced > Custom Javascript and add:

jQuery( window ).on( 'nfFormSubmitResponse', function(e, response, id) {
    if (response.id == '2') {
        const campaign = FireBox.getInstance({fpf fb.id});
        campaign.close();
    }
});
  • Replace 2 with your Ninja Form ID.

Now, whenever the form is submitted, the campaign will automatically close.

Was this helpful?