title: How to send "response" back to submitted Ajax form?
body: <p>I am submitting a form using ajax. Then it is processed in PHP, and in the <code>response</code> i get the whole PHP/HTML code back. What is the right method to send back a "response" as variables from the PHP?</p>
  
  <p>My JS</p>
  
  <pre><code>$.ajax({
      url: 'index.php',
      type: 'post',
      data: {
          "myInput" : $('#myInput').val(), 
      },
      success: function(response) { 
          if(!alert(response)) {
          // do something
          }
      }
  });
  </code></pre>
  
  <p>and my PHP simply accepts the posted Input value and manipulates it:</p>
  
  <pre><code>if (isset($_POST["myInput"])) {
      // doing something - and I want to send something back
  }
  </code></pre>