用ajax显示php成功消息时遇到问题

Here is my below code I'm just trying to send a message form with php script but the message is submitted well. but when it comes to showing success message I'm having trouble page submits the data but shows no code.

<script type = "text/javascript" language = "javascript">
     $(document).ready(function() {
        $("#send").click(function(event){
            var name = $("#name").val();
            var email = $("#email").val();
            var message = $("#message").val();

            $.ajax({
                type: "POST",
                url: "process.php",
                data:{
                    name: name,
                    email: email,
                    message: message,
                },
                success:function(data) {
                 $('#msg').html(data);
              }
            });
        });
     });
</script>

Below is php and html code:

<?php
include 'db.php';
$name=$_POST["name"];
$email=$_POST["email"];
$message=$_POST["message"];
$query = mysqli_query($con, "INSERT INTO test(name, email, message) VALUES ('$name', '$email', '$message')");
if($query){
echo "Your message has been sent successfully!";
}
else{
echo "Your message has been not sent successfully!";
}
mysqli_close($con);
?>

<form action="" method="POST" enctype="multipart/form-data">
    <input type="text" class="form-control" id="name" name="name">
    <input type="text" class="form-control" id="email" name="email">
    <textarea class="form-control" rows="5" id="message" name="message"></textarea>
    <button id="send" type="submit" class="btn btn-primary">Send</button>   
</form>
<div id="msg" class="alert alert-success hidden"><strong></strong></div>

It is because your form will be submitted as the button has the type submit. By changing the type to button the ajax should be working.

Change type="submit" to type="button"

I hope this will help!