You can easily fetch data from the server and show them in UI by simple a few lines of code.

At the html file, we just need to add a table with id.

Also, you need to add the reference of jQuery and Data Table plugin at html file. Like below

Now inside the jQuery file, you need to add the following code to fetch data from the server and populate the view.

Here url indicates from where data will be fetched.

If you need to refresh the table use it.

When you call reload, it also sends the value after getting from input element automatically.

You can also pass the data with your request. For that, you need to add data param inside ajax request. See the commented code. And set your desired values.

And server-side action should be like below.

 

Search Param Model:

 

Fetch data from the database, if you need:

 


Leave a Reply

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