Skip to content
Advertisement

Displaying data in table(view) passed from Controller – Codeigniter

I want to display data in table on inserting data as well as when the page is loaded. Storing data successfully works with the code but the issue is;

  1. When I use POST, the form data is completely visible in the URL.
  2. How do i display all data passed in json format in html table.

HTML:

JavaScript

JAVASCRIPT:

JavaScript

CONTROLLER:

JavaScript

Advertisement

Answer

Try to pass the result to <tbody> use JQuery

JavaScript

And when you want add new data jast call your getData().

JavaScript

Also look at e.preventDefault for your ajax call. If you use ajax needlessly reload page

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement