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.
-
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– Jim Garrison2011-12-24 20:19:26 +00:00Commented Dec 24, 2011 at 20:19
-
I think you're mising the programming language/platform you use for your front-end/web?rene– rene2011-12-24 20:20:08 +00:00Commented Dec 24, 2011 at 20:20
Add a comment
|
3 Answers
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.
Comments
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: