How to create and popular a table using jquery and database?

Asked

Viewed 940 times

3

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

I’m already using it in my Java, Javascript, jQuery and HTML project. Is there any way to do this with jQuery? If not, any idea that meets this need will be welcome.

  • Hello, if I understand correctly there is already the created page. What you want is to use ajax (which you can do with jquery) that updates the table. I understood well?

  • A friend solved the problem here at work just before me. He did with javascript and json, my solution was with angular and json. All two met the need. I decided to use the solution of the guy here for the sake of making the project cleaner, because already use in the application the javascript, obtei by not using the angular despite being a more complete solution.

  • Hello, post please the solution and mark as right. So it gets answered and can help others who have the same question.

  • As soon as possible I will be posting. Thank you.

  • If you solved your problem, it would be interesting for you to answer your question, so that people with the same problem can have a solution.

1 answer

1

Good by what you describe exercise 2 steps that are required.

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

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

I hope I’ve helped

Browser other questions tagged

You are not signed in. Login or sign up in order to post.