pass data from ajax in php : i want to pass data from ajax. can anybody please tell me how is that possible??

here is my index.php

       <form method="post" action="">
       <input type="text" id="class_name" name="class_name">
       <input type="hidden" name="user_id" id="user_id" value="<?=$user_id?>" />
            
       <button id="submit" name="submit" value="submit" type="submit"></button>
       </form>


and here is update.php

    <?
        if(isset($_POST['submit'])) {
    
        user_id= $_POST['user_id'];
        class_name= $_POSt['class_name'];
        $date= date("M d , Y");
       
        $sql_ins="insert into chat set user_id='$user_id', class_name='$class_name', 
        time=now(),date='$date'";
        $sql_que=$db->db_query($sql_ins);
        }
    ?>


how can i pass this data into server via ajax not from action..??
what is the ajax script for that??
Thanks in advance
