This recipe shows you how to POST and submit a form using Ajax and also how to submit the same forum when not using Ajax. The Blog Comments form used in the previous recipe is used here for submission.
Copy the full code of this recipe from the
code/05/submit-form sources folder. This code can be launched using the URL
http://localhost:8080/05/submit-form/main.html. To try out this recipe, you will also need to launch the simple nodejs web server that is shipped along with the source code of this book. Launch the server by using the following command:
main.html, create the Blog Comments form as shown in the following code:
<form id='commentform' action='/postComment' ...