1
This one and HTML
<div class="widget widget-table action-table">
  <div class="widget-header"> <i class="icon-check"></i>
  </div>
  <div class="widget-content">
    <table class="table table-striped table-bordered">
      <tbody>
        <br/>
        <center>
          <textarea  cols="150" rows="7" class="input-xxlarge" type="text" id="login" name="login" placeholder="Sua lista"></textarea> <br /><br />
          <button class="btn btn-mini btn btn-success" id="submitValidacao"  type="submit">Iniciar teste</button>
          <button class="btn btn-mini btn btn-danger" type="button">Cancelar e limpar</button>
        </center>
    <hr>
      </tbody>
        </table>
      </div>
    </div>
<!-- RETORNO -->
<div class="widget widget-table action-table">
  <div class="widget-header"> <i class="icon-thumbs-up"></i>
    <h3>Retorno</h3>
  </div>
  <div class="widget-content">
    <table class="table table-striped table-bordered">
     <center>
      <div class="returnEmail"></div>
      <div class="testEmail"></div>
      <div class="resultEmail" style="width:70%; height:100px; overflow:auto; padding:1%; border:1px solid; margin-top:1%;" >Emails Validos<br/></div>
     </center>
     <br>
    </table>
  </div>
</div>
in the textarea I put a great list of email:name being like this.
email:nome
email2:nome2
email3:nome3
so on and so forth
and send the post pro javascript
<script type="text/javascript">
  $(document).ready(function(){
  $('.resultEmail').hide();
  $('#submitValidacao').click(function(){
    var logins = $('#logins').val();
    var loginsSplited = logins.split("\n").reverse();
        var loginsSplited = logins.split("\n");
      var loginsSplitedCount = loginsSplited.length;
      $('.returnEmail').html("<hr><b>Testando "+loginsSplitedCount+" Login...<br>Aguarde...</b><br>");
      var counter = 0;
$.each(loginsSplited, function (i, val) {
        $('.testEmail').html("Testando agora = "val);
        $.post('pages/engines/email.php', {
            login: val
        }, function (retorna) {
            $('.resultEmail').show();
        $('.resultEmail').append(retorna);
            counter++;
            if (counter === loginsSplitedCount) {
                $('.returnEmail').html("<hr><b>Testando " + loginsSplitedCount + " Login...<br>Pronto!</b><br>");
                $('.testEmail').html("<font color='gren'>Teste finalizado com sucesso!</font>");
            };
        });
    });
  });
});
</script>
now in the  $('.testEmail').html("Testando agora = "val); shows only Testing now = email:name that is the first value of the list that was added in the textarea, and when action ends it calls the  $('.testEmail').html("<font color='gren'>Teste finalizado com sucesso!</font>");
replacing the Testing now = .
the problem is that I can not pass the values right in Testing now = , getting email:name and when it ends it already came Email2:Nome2 , because php already returns 1 by 1 ..
could show me the link ?
– Wender
I think your problem here is the same as the other question I marked as duplicate. I mean, you have to have that
if (counter === loginsSplitedCount){insidefunction(retorna){because ajax is asynchronous. http://answall.com/questions/60852/return-em-each-getjson-jquery– Sergio
That I have done and I do not function and that question there does not answer my . even so thank you
– Wender
I don’t think you understand the asynchronous nature yet. I reopened it for myself or someone to explain it to you. But the problem is asynchrony as in the other question.
– Sergio
I’ll try here Sergio, I’ll read here.
– Wender
What I really want is just to send the post and get the information that php returns :( if I upload a large list it tells which one is testing I think I’m missing somewhere .
– Wender
Try this: http://jsfiddle.net/z1qtj621/
– Sergio
From my point of view the reason is that by default javascript is asynchronous, what I suggest is to change to synchronous, so it will run the
ajaxand only after he has finished executing theifjust below.– Guilherme Lautert
Following link with reply on synchronous. http://stackoverflow.com/questions/5821380/how-to-make-a-jquery-post-request-synchronous
– Guilherme Lautert