title: Is there any chance ajax call to finish after the next line of code?
body: <pre><code>    $("#ajaxform").submit(function(e){
          var info = $(this).serialize();
          $.ajax(
          {
              url : "controller",
              type: "post",
              data : info,
              success:function(data, textStatus, jqXHR) 
              {
                   $('.valid').html(data);
              }
          });
          e.preventDefault()
      });
      $(".mainbutton").click(function(){
          $("#ajaxform").submit();
          if($('.valid').html(data) == "success"){ // could this fail?
              var info = $("#ajaxform").serialize();
              $.get("controller", info);
          }
      });
  </code></pre>
  
  <p>I am making ajax call and in the response I put "success". Is there any chance if($('.valid').html(data) == "success") to be called before and of ajax call and in fact fail the if statement ?</p>