What is the most simple way to insert values into a mysql database without reloading the page? In this particular example, I'd like to have a form with one input field, and when the form is submitted, the user's input to the field is inserted into a mysql database table, but the page is not reloaded.
Asked
Active
Viewed 6,878 times
0
-
You would have to submit the data via Ajax. Once the browser itself submits the form it is expecting a response from the server with a new page to be displayed. – Jim Garrison Dec 24 '11 at 20:19
-
I think you're mising the programming language/platform you use for your front-end/web? – rene Dec 24 '11 at 20:20
3 Answers
1
You can use AJAX to send content to a server side file (without reloading) and that file can insert row(s) in the database. Here's an example : http://www.9lessons.info/2009/08/vote-with-jquery-ajax-and-php.html Here, this guy creates a digg like vote button and it inserts and updates rows without reloading the page. Check it out.

Abhishek Biswal
- 450
- 5
- 18
0
This requires AJAX.
You CAN do this with plain JS, but jQuery makes your life a lot easier.
See this post for a good example: