Jquery - Loop a function

0

Good evening, everyone. I'm learning a little Jquery and wanted some help. I have the following code:

$(document).ready(function(){
$('#btnEnviar').click(function(){
    var caminho = ("/uploads/");

    $("input[name='arquivo']").each(function() {


        $('#formUpload').ajaxForm({
            uploadProgress: function(event, position, total, percentComplete) {
                $('progress').attr('value',percentComplete);
                $('#porcentagem').html(percentComplete+'%');
            },          
            success: function(data) {
                $('progress').attr('value','100');
                $('#porcentagem').html('100%');                
                if(data.sucesso == true){
                    $('#resposta').html('<img class="photo_uploaded" src="'+caminho+''+ data.msg +'" />');
                }
                else{
                    $('#resposta').html(data.msg);
                }                
            },
            error: function(){
                $('#resposta').html('Erro ao enviar requisição!!!');
            },
            dataType: 'json',
            url: 'upload3.php',
            resetForm: true
        });
    });
});

});

I'm trying to loop the function so that each image is loaded 1-in-1. But it's loading everything together. Can someone help?

Sorry for any posting errors.

    
asked by anonymous 13.08.2015 / 00:05

0 answers