I need some help with a button onClick
.
<button type="button" id="1" onclick="this.disabled=true; ^FUNCTION TO UPDATE^">
<button type="button" id="2" onclick="this.disabled=true; ^FUNCTION TO UPDATE^">
<button type="button" id="3" onclick="this.disabled=true; ^FUNCTION TO UPDATE^">
With this code I disable the button that was pressed, but I also need to update info in a database sending the id, something like this:
UPDATE reservation SET status='approved' WHERE id=^ID OF THE CLICKED BUTTON^
I need it to be loaded in the same page without sending it with POST
or GET
.
With plain javascript you can do something like this:
For output make sure you have a div with the id equal to target.
Use ajax call for this eg:
see http://api.jquery.com/jQuery.get/ for more info.