POST Request: Process HTML5 form with Ajax
The following example demonstrates an HTML5 form saving data via an Ajax API call using the
POST method. The ajax call will be processed by an REST resource written in xml.
Basic knowledge of the following technologies.
On Client Side
When the end-user inputs the data in the form and clicks the submit button the form data is sent with the HTTP POST method, this data onsubmit function catches the data and with the help of the xhr.send request sends the data to the respective URL.
On the Network
The form-data format for sending data over the network to the server.
On Server Side
The parameters sent in the POST request are received and replaced with their corresponding $ symbols. These $ variables must match the exact names of the POST params that are sent in the request. Here's the resource
In the Database
If you query the
user table, you can find the data just saved from the form.
This example demonstrated
POST method. The next example shows how to use the
GET ajax call results.