title: Why is my attempt at a basic Ajax script not working?
body: <p>I'm currently trying to learn the basics of Ajax through example. By following a basic tutorial, I've managed to create the following script:</p>
  
  <pre><code>&lt;!DOCYTPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"&gt;
  $(function(){
    $('#mybtn').on('click', function(e){
      e.preventDefault();
      $('#mybtn').fadeOut(300);
  
      $.ajax({
        url: 'ajax-script.php',
        type: 'post',
      }); // end ajax call
    });
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;a href='#' id='mybtn'&gt;click me&lt;/a&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>Combined with a simple php file named ajax-script.php which contains the following code:</p>
  
  <pre><code>&lt;?php
  
  if($_POST) {
    echo "&lt;p&gt;ok&lt;/p&gt;";
  }
  
  ?&gt;
  </code></pre>
  
  <p>Can anyone identify what I might have done wrong? How can I make this work?</p>