title: Send data to php file using ajax
body: <p>I have a trouble receiving data sent using ajax in a php file. It seems that ajax sends data, cause I get a success message, but php page shows me an error "Notice: Undefined index: ab".</p>
  
  <p>Here is my jquery code for sending data using AJAX:</p>
  
  <pre><code>$('#download-btn').click(function(){
      var ab="abc";
      $.ajax({
          url:'generate_url.php',
          data:{'ab':ab},
          type:'post',
          success:function(data) {alert("sent");},
          error: function(request, status, error) {alert(request,status);}
      }); 
  }
  </code></pre>
  
  <p>And that's how I extract data in a generate_url.php:</p>
  
  <pre><code>&lt;?php
      $a = $_POST['ab'];
      echo $a;
  ?&gt;
  </code></pre>
  
  <p>Thanks in advance for your help!</p>