Using AJAX to submit and return data inside the WordPress Plugin Boiler Plate framework

I am using the WordPress Plugin Boilerplate to show a form to the user via shortcode. I am just a little confused of the flow of data not so much the syntax to do it.

My Main Public Class has a method that creates a form when a user adds the shortcode. I have a class that can take the form data and build a URL that calls an API.

This is how I thought it should work:
1. Javascript function fires when “Submit” is clicked. It checks to make sure the form is complete if so use AJAX to pass the data to my Processesing script.
2. The script builds the URL and calls the API and data should be returned.

Question: Once the data is returned can I pass the data and update the original page with the form to show the data? This is were I am not 100% sure how to do.

So the user experience should include completing the form, submitting (maybe a loader animation) and the data appears below the form.

****I don’t need code I am just looking for an direction on the flow of data.**

Read more here:: Using AJAX to submit and return data inside the WordPress Plugin Boiler Plate framework

Leave a Reply

Your email address will not be published. Required fields are marked *