title: print ajax response with php
body: <p>I cannot get the alert to work after sending the data in ajax? Could anyone tell me what I'm doing wrong?</p>
  
  <p>My form:</p>
  
  <pre><code>  &lt;body&gt;
  
  &lt;form action="" id="form1" method="post"&gt;
    First name:&lt;br&gt;
    &lt;input type="text" name="firstname" value="Mickey"&gt;
    &lt;br&gt;
    Last name:&lt;br&gt;
    &lt;input type="text" name="lastname" value="Mouse"&gt;
    &lt;br&gt;&lt;br&gt;
    &lt;input type="submit" id="submit1" value="Submit"&gt;
  &lt;/form&gt;
  
  &lt;!-- jQuery library --&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"&gt;&lt;/script&gt;
  
  &lt;!-- Latest compiled JavaScript --&gt;
  &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"&gt;&lt;/script&gt;
  
  
  &lt;script&gt;
      // AJAX SEND POST DATA
      $('form').on('submit', function() {
          var self = this;
          $.ajax({
              type: 'post',
              url: 'submit2.php',
              dataType: 'json',
              data: $(self).serialize(),
              success: function() {
                  alert("blabla");                    
              }
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>This is my submit2.php file. </p>
  
  <pre><code>&lt;?php echo "bla"; ?&gt;
  </code></pre>