REST interfaces are popular in CRUD applications as it provides a clean and well defined interface between the client and server. Editor can be fully integrated with a REST environment through its ability to specify different URLs for the create, edit and remove actions of Editor. This is done by giving ajaxUrl as an object with the create, edit and remove properties specified with the URL to use for each action, as shown in this example.
In addition to being able to specify a unique URL for each action, you can also specify which HTTP method you which to use. This is useful for REST interfaces where there the method can have significant meaning and is done simply by adding the method name at the start of the URL for the action, followed by a space (again, as shown in this example). Also you can use the string "_id_" which will be automatically replaced by Editor with the ID of the row being edited.
| Browser | Rendering engine | Platform(s) | Engine version | CSS grade |
|---|---|---|---|---|
| Browser | Rendering engine | Platform(s) | Engine version | CSS grade |
The Javascript below is what is used on this page for the example shown.
The HTML shown below shows the TABLE that is used in this example.
As the PHP is split over multiple files for this example, please refer to the file in the php/rest directory directly.
The HTML shown below includes the Javascript and CSS files that are required for the Editor operation on this page. You can use this as a template for your own pages, but if you move the files you might need to update the paths.
Editor submits and retrieves information by Ajax requests. The two blocks below show the data that Editor submits and receives, to and from the server. This is updated live as you interact with Editor so you can see what is submitted.
The following shows the data that has been submitted to the server when a request is made to add, edit or delete data from the table.
// No data yet submitted
The following shows the data that has been returned by the server in response to the data submitted on the left and is then acted upon.
// No data yet received
DataTables can request information to display from the server when the page first loads. The block below shows the response from the server.