javascript – How to create and populate a table using jquery and database?

Question:

I need to create a table in HTML that populates the rows and columns with data coming from a specific table in my database. But I want that whenever new data is inserted in this database table, it automatically appears to the user in the HTML table. This is all without doing the entire page load again.

I'm already using Java, JavaScript, jQuery and HTML in my project. Is there any way to do this with jQuery? If not, any ideas that meet this need are welcome.

Answer:

Well for what you describe exergo 2 steps that are necessary.

  • I believe that a solution would be for you to make a service to receive the information since it is a database, so the method would return this data and you would just make the Javascript with jQuery to consume the service.
  • About updating the fields, well you need to use a pattern that, if I remember correctly, is the OBSERVER. From x to x time it queries the method and changes if it has content.

I found this example on stackoverflow in English: https://stackoverflow.com/questions/4629642/how-can-i-refresh-a-page-when-a-database-is-updated

Hope this helps

Scroll to Top
AllEscort