Skip to content
Advertisement

Refresh specific HTML content that retrieves data from MySQL

So i have a form that that does a simple calculation, depending on the users input. If the results is a certain value then it stores that value in a database, then it displays that value on a page. But i have to refresh the whole page for it to retrieve the latest updated value from the the database and display on the page.

I know how to write code to refresh the whole page, but in this case i only need the section where the it displays to be refreshed.

The original form to calculate

JavaScript

The form that gets the new values from the database

JavaScript

Calculation

JavaScript

Advertisement

Answer

I managed to find the solution for this code using Ajax and jQuery:

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