$(document).ready(function(){
    $('.button').click(function(){
        var clickBtnValue = $(this).val();
        var ajaxurl = 'functions/delivered.php',
        data =  {'action': clickBtnValue};
        $.post(ajaxurl, data, function (response) {
            // Response div goes here.
            alert("action performed successfully");
        });
    });
});
This is the ajax code and I am trying to update my database
functions/delivered.php:
<?php
$db=new mysqli("localhost","root","","restaurant")
if(isset($_POST['onum'])){
    $onum=$_POST['onum'];
    $query="UPDATE `revenue` SET `payment`='y' WHERE onum=$onum";
    $db->query($query);
}
?>
 
    