continue in for loop after function is done JavaScript
<p>I have found behaviour that makes me trouble in JavaScript. I have two  functions: </p>

<p><code>var show_uploaded = function( data_photo )</code> that gets informations about uploaded photos as a parameter,  </p>

<p><code>function exif_like(path){/*working with my image*/ console.log('exif_like END'); }</code><br>
that gets path to every single one uploaded photo as a parameter.  </p>

<p>I made code like this:</p>

<pre><code>var show_uploaded = function( data_photo ){
    for( var z = 0; z &lt; data_photo.length; z++ ){ 
       var send_image_name = uploaded_photo[z].name;
       $.ajax({
            data: { compare : send_image_name },
            url: 'get_panorama.php',
            method: 'POST', // or GET
            success: function( path ){
                exif_like( path );
                console.log('FOR LOOP END');
            }
       });
    }
};
</code></pre>

<p>But what I see in console is that "FOR LOOP END" log is displayed before "exif_like END" log. And this causes some unpredictable behaviour in my code.</p>

<p>Is there any solution how to continue for loop after exif_like() function is done?</p>