title: Get a variable after ajax when done
body: <pre><code> $('#submit_id').click(function(){
      function mark() {
          $.ajax({
            type: "POST",
            url: "request1.php",
            data: $('#form_id').serialize(),
            cache: false,
            success: function(data1){
            }
          });
      }
      function other() {
          $.ajax({
            type: "POST",
            url: "request2.php",
            data: $('#form_id').serialize(),
            cache: false,
            success: function(data2){
            }
          });
      }
      $.when(mark(), other()).done(function(data1, data2)
      {
          console.log(data1);
          $(".results1").html(data1);
          console.log(data2); // Result
          $(".results2").html(data2);
  
      });
  
  });
  </code></pre>
  
  <p>I need to pass the returned data into a variable like:</p>
  
  <blockquote>
    <p>console: undefined</p>
  </blockquote>