2

I am trying to post data using AJAX.

The docs describes a method here. But that is mainly for jQuery.

I have also looked at this url, 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?

1

From the action you are currently posting to a controller see here

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.