Answers.Body: <p>You need to specify the HTTP method used by <a href="http://api.jquery.com/jquery.ajax/" rel="nofollow noreferrer">the <code>$.ajax</code> method</a>. </p>
  
  <p>By default, it uses <code>GET</code>, but you need to submit the form using <code>POST</code>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-30T22:36:08.660Z
Answers.LastActivityDate: 2017-04-30T22:36:08.660Z
Answers.UserDisplayName: Stephen Lewis
Body: <p>I am using the <a href="https://squarebit.co.uk/software/craft/charge" rel="nofollow noreferrer">Charge</a> plugin to handle my Stripe payments. How could I submit this form via Ajax Post and get the response? I have tried using the following code but it tells me it's a bad request:</p>
  
  <pre><code>this.ajaxReq = $.ajax({
     url: 'charge/charge',
     data: $('#charge-form').serialize()
  }) .done(function(data) {
     console.log('success!');
     console.log(data);
  }) .fail(function(data){
     console.log(data);
  });
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-04-29T18:34:18.593Z
Comments.Text: Are you using the Stripe.js checkout option, as detailed in [the Charge documentation](https://squarebit.co.uk/software/craft/charge/usage/quickstart/using-stripe-js)?
Comments.UserDisplayName: Stephen Lewis
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-04-29T23:27:05.793Z
Comments.Text: Yes, I'm looking to modify the $form.get(0).submit(); that's part of jquery.charge so that this submission is sent via Ajax without a page refresh
Comments.UserDisplayName: Jai Sandhu
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-04-30T04:11:07.567Z
Comments.Text: Have you specified the `$.ajax` method? It uses `GET` by default, but you need to submit the form using `POST`.
Comments.UserDisplayName: Stephen Lewis
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-04-30T23:15:12.043Z
Comments.Text: You're welcome. I added my comment as an answer. If you can accept it, then we can close this one out.
Comments.UserDisplayName: Stephen Lewis
Tags: <plugin-charge>
Title: How could I submit the Charge plugin using Ajax?
ThreadText: # How could I submit the Charge plugin using Ajax?
  
  (Asked by: username_0 on 2017-04-29)
  
  I am using the [Charge](https://squarebit.co.uk/software/craft/charge) plugin to handle my Stripe payments. How could I submit this form via Ajax Post and get the response? I have tried using the following code but it tells me it's a bad request:
  
  ```
  this.ajaxReq = $.ajax({
     url: 'charge/charge',
     data: $('#charge-form').serialize()
  }) .done(function(data) {
     console.log('success!');
     console.log(data);
  }) .fail(function(data){
     console.log(data);
  });
  
  ```
  
  **Tags:** plugin-charge
  
  > **Comments:**
  > **username_1**: Are you using the Stripe.js checkout option, as detailed in [the Charge documentation](https://squarebit.co.uk/software/craft/charge/usage/quickstart/using-stripe-js)?  
  > **username_0**: Yes, I'm looking to modify the $form.get(0).submit(); that's part of jquery.charge so that this submission is sent via Ajax without a page refresh  
  > **username_1**: Have you specified the `$.ajax` method? It uses `GET` by default, but you need to submit the form using `POST`.  
  > **username_1**: You're welcome. I added my comment as an answer. If you can accept it, then we can close this one out.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-04-30. Score: 1 | Accepted answer
  
  You need to specify the HTTP method used by [the `$.ajax` method](http://api.jquery.com/jquery.ajax/).
  
  By default, it uses `GET`, but you need to submit the form using `POST`.
  
  
  ---
  
  