title: Ajax Jquery Function response
body: <p>I am learning to use jQuery Ajax. What does <code>function(response)</code> mean and what is the meaning of <code>response == 1</code> and <code>response == 2</code>?</p>
  
  <pre class="lang-js prettyprint-override"><code>jQuery.post(ajaxurl, data, function(response) {
    if (response == 1) {
      $saveAlert.addClass('is-success').delay(900).fadeOut(700);
      setTimeout(function() {
        $tieBody.removeClass('has-overlay');
      }, 1200);
    } else if (response == 2) {
      location.reload();
    } else {
      $saveAlert.addClass('is-failed').delay(900).fadeOut(700);
      setTimeout(function() {
        $tieBody.removeClass('has-overlay');
      }, 1200);
    }
  });
  </code></pre>