HOW TO UPDATE AND OUTPUT DATABASE WITHOUT RELOADING THE PAGE? : I'm sorry if this may seem so redundant. But I tried my best to understand other posts' problems that is same as mine but still i can't get into any solutions. So just please bare with me this time.

Okay. So I have a data which is a name. And I am having an **input type=text** where the value is equals to the name, together with a **button type=submit**. So what i'm trying to do is that, i want to change and update the name in my database and also output the new name without reloading the page at once because i want to run a JS function (Not Alert but a Toast Notification) which is i cannot do. So to shorten, ( EDIT -> UPDATE -> SHOW = without reloading the page). Please help me. Thank you in advance.

**profile.php (FORM CODE)** 

    <form action="profile.php" method="GET">    
          <input type="text" id="changename" name="changename" class="form-control" placeholder="New Name" required>
          <button id="btnchange" type="submit"></button>
    </form>

**profile.php (PHP CODE)**

        <?php
        if(isset($_POST['changename'])) {
            require 'connect.php';

            $newname = $_POST['changename'];
            $user_id = $_SESSION['temp_user'];
            
            $sql = "UPDATE login SET login_name='$newname' WHERE user_id='$user_id'";
            if(mysqli_query($conn, $sql)){
                header('location: profile.php');
                // MY JS FUNCTION HERE //
            }

            mysqli_close($conn);
        }
    ?>

