Submitting data to JotForm servers through Angular JS code instead of default submission process

  • SixPlus
    Asked on March 8, 2016 at 12:31 PM

    I am using Angular and I am using the source code for the jotform to handle form submissions. The ngClick (or ngSubmit) event in Angular conflicts with the form action. Ideally, I would like to just submit the POST request to the jotform URL contained within the action attribute of the form, while handling the rest of my business logic. This would also allow me to preserve the single-page-application nature of our website because I can redirect to another page on our site by preventing the event default page refresh. 

    If i were to take out the form action attribute, does the form action link receive JSON data and could you outline how to structure this data as an HTTP request body so I can just handle the form action myself through Angular?

     

    Thanks.

  • Ben
    Replied on March 8, 2016 at 2:34 PM

    In general if you submit the data as it is submitted through the general POST method, it will work properly, but if you wish, you can - and in this case might be more desirable - submit the data through the API.

    You can see more about this here: http://api.jotform.com/docs/#post-form-id-submissions

    It will show you how to post the data through the POST to your specific form. You could alternatively use PUT instead of POST if you prefer.