Answers.Body: <p>From the action you are currently posting to a controller <a href="https://craftcms.com/docs/plugins/controllers" rel="nofollow noreferrer">see here</a> </p>
  
  <p>The example shows that in your case it would be looking for a plugin called "Freeform" with a controller named "api" and then within that controller there would need to be a "form" action.  If this isn't there then the page will return a 404 or error as it cannot find the route.</p>
  
  <p>You may be able to create the same thing without using jQuery with something like <a href="https://stackoverflow.com/questions/8567114/how-to-make-an-ajax-call-without-jquery">this method</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-26T17:25:38.387Z
Answers.LastActivityDate: 2018-02-26T19:28:01.847Z
Answers.LastEditDate: 2018-02-26T19:28:01.847Z
Answers.UserDisplayName: Phil
Body: <p>I am trying to post data using AJAX.</p>
  
  <p>The docs describes a method <a href="https://solspace.com/craft/freeform/docs/ajax-forms/" rel="nofollow noreferrer">here</a>. But that is mainly for jQuery.</p>
  
  <p>I have also looked at <a href="https://expressionengine.stackexchange.com/questions/25347/solspace-freeform-how-to-send-file-via-ajax-with-freeform">this url</a>, which also uses jQuery.</p>
  
  <p>But from what I understand, the "action" parameter in <code>&lt;input type="hidden" name="action" value="freeform/api/form"&gt;</code>is where the data is sent. But if I send data to that URL, I get a 404.</p>
  
  <p>How do I properly submit a form using AJAX?</p>
  
Tags: <ajax><plugin-freeform><solspace>
Title: Solspace Freeform plugin: AJAX without jQuery – how?
ThreadText: # Solspace Freeform plugin: AJAX without jQuery – how?
  
  (Asked by: username_0 on 2017-12-06)
  
  I am trying to post data using AJAX.
  
  The docs describes a method [here](https://solspace.com/craft/freeform/docs/ajax-forms/). But that is mainly for jQuery.
  
  I have also looked at [this url](https://expressionengine.stackexchange.com/questions/25347/solspace-freeform-how-to-send-file-via-ajax-with-freeform), which also uses jQuery.
  
  But from what I understand, the "action" parameter in `<input type="hidden" name="action" value="freeform/api/form">`is where the data is sent. But if I send data to that URL, I get a 404.
  
  How do I properly submit a form using AJAX?
  
  **Tags:** ajax, plugin-freeform, solspace
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-02-26. Score: 1
  
  From the action you are currently posting to a controller [see here](https://craftcms.com/docs/plugins/controllers)
  
  The example shows that in your case it would be looking for a plugin called "Freeform" with a controller named "api" and then within that controller there would need to be a "form" action. If this isn't there then the page will return a 404 or error as it cannot find the route.
  
  You may be able to create the same thing without using jQuery with something like [this method](https://stackoverflow.com/questions/8567114/how-to-make-an-ajax-call-without-jquery)
  
  
  ---
  
  