I am not able to get the response to ajax success call back function. The response form the server is being directly printed on the browser
<body>
    <script>
      $(document).ready(function() {
        $.ajax({
          url: $("#form").attr("action"),
          type: "POST",
          data: $("#form").serialize(),
          success: function(data) {
            alert(data);
          }
        });
      });
    </script>
    <form action="a.php" method="post" id="form">
      <input type="text" name="name" id="name" placeholder="name" />
      <input type="submit" value="submit" />
    </form>
  </body>
my php code
<?php
    echo 'hii';
?>
 
     
    