Eksekusi PHP dengan Jquery Ajax Javascript

berikut ini cara jalanin script php atau Eksekusi PHP dengan Jquery Ajax Javascript
<input name="user" type="text">
<button name="submit" type="button" onclick="clickme()">ENTER</button>
<div id="loader" style="display: none;">
  <img src="ajax-loader.gif" width="32px" height="32px">
</div>
<pre id="pesan"></pre>


<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
var clickme = function(){
var mystring = $('input[name=user]').val();
   $.ajax({
      url: 'view1.php',
      type: 'POST',
      data: {username : mystring},
      beforeSend: function(){ $('#loader').show();},
      success: function(data){ $('#pesan').html(data);},
      complete: function(data){ $('#loader').hide();}
  });
 }
</script>