Paul Dessert
Paul Dessert

Reputation: 6389

Is it possible to process a stripe form via AJAX?

I have this:

<form class="blocked-form efocus" action="form_process.php?source=payment" method="post">
    <input type="hidden" name="fee" value="1795">
    <script src="https://checkout.stripe.com/v2/checkout.js" class="stripe-button"
          data-key="<?php echo $stripe['publishable_key']; ?>"
          data-amount=1795 data-description="Month-to-month Package">
    </script>
</form>

To process this, I'm using form.ajaxSubmit but since I'm not using a submit button such as:

<input type="submit" name="submit" class="general-button" value="Save and Continue" />

It won't process via AJAX. Is there a way to process form_process.php?source=payment when clicking on the external button provided by stripe?

Upvotes: 0

Views: 1446

Answers (1)

Arun P Johny
Arun P Johny

Reputation: 388316

You can trigger the form submit manually by registering a click handler for the external button

$('my-button').click(function(){
    $('form.efocus').submit()
})

Upvotes: 1

Related Questions