I have a website which basically is an audioplayer and an integrated lyricviewer on screen, which the user should be able to sync with the music they hear playing. I only have one problem, and that is; How on earth do I, from a javascript function, call a mysqli update statement? When the user clicks a save button, content gets thrown into a div, which I want the PHP after the JavaScript has been run to take that content and put it into a database.
What is the best way to do that?
Why doesn't this work?
        function saveinPHP() {
        //alert("Came here");
        //var superstr = $( "#savelyric" ).text();
        var superstr = 'lol';
        $.ajax({
        type: "POST",
        url: "includes/sendlyrics.php",
        data: superstr,
        cache: false,
        contentType: false,
        processData: false,
        success:  function(data){
            alert("---"+data);
            alert("Settings has been updated successfully." + data + "~~~" + superstr);
            //window.location.reload(true);
        }
    });
    }
And then the PHP:
    <?php 
include ('db_connect.php');
$data = $_POST['data'];
    $query = "UPDATE song SET time=". $data ." WHERE id='1'";
    mysqli_query($query);
?>
 
     
     
    