title: jQuery send and display ajax result per line of textarea
body: <p>I have the form with text area.In the text area user can enter keywords per line.</p>
  
  
  
      
  
  
      
  
  
  
  <p><img src="https://i.stack.imgur.com/vzMyS.png" alt="enter image description here"></p>
  
  <p>I want to do like this.
  After click the button send ajax request to the server and get result of the first keyword.Then display/append it.After that finished send second ajax request for 2nd keyword.Like this for per each keyword. </p>
  
  <p>I want to do this because of server response is little slow per keyword.If display all keyword output at once that is getting too many time to see the result. So in above method  I think user no need to wait for see the all results.User can see one by one keyword output.</p>
  
  <p>My code is like this and I'm using this in the wordpress plugin.Get result as <strong>json</strong>.</p>
  
  <pre><code>jQuery(document).ready(function () {
  
   jQuery('#get_seo_rank').click(function() {  
  
      var keywordLines = jQuery('#keywords').val().split(/\n/); 
      var current = 0;
      var total = keywordLines.length;
  
  
      for (var i=0; i &lt; total; i++) {
              jQuery.ajax({
                type : "post",
                dataType : "json",
                url : process.php,
                data : {
                          action: "get_rank", 
                          keywords: keywordLines[i]
                      },
  
                    beforeSend:function(){
  
                    },
                    success:function(response){
  
                          if(response.type == "success") {
                             jQuery("#resultWrap").append(response.result);
                          }
                          else if(response.type == "error") {
                             jQuery("#resultWrap").html(response.result);
  
                          } else {
                               jQuery("#resultWrap").html(response.result);
                          }
  
                    },
                    error:function(response){
  
                    }
  
  
             }); 
  
      }  // end loop
  
  
  }); // end click event
  
  });
  </code></pre>
  
  <p>If anyone can help regarding this that would really appreciate.</p>
  
  <p>Thank you very much !</p>