Unable to add <img> inside the <div> using jquery
<p>This is how I add the images inside the <code>&lt;div id = 'book'&gt;....&lt;/div&gt;</code> . Unfourtunely it does not create any img tag as I expected. What is the error?  The paths is confirmed contains value . </p>

<pre><code>$('#book').append('&lt;img src ="' + paths[1] + '" style = "width:100%;height:100%;top:1px;left:1px" alt = "flip book" id = "logo-cover" /&gt;');
</code></pre>

<p>Update:</p>

<p>This may due to the path[1] value , it is using for loop to iterate an array
it is possible an empty value, but it should be skipped as i have checked before append...</p>

<p>Whole script</p>

<pre><code>    &lt;script&gt;
function load_pages(page) {
    $.ajax({
        type: "GET",
        url: "scandir.php",
        data: "page=" + page,
        dataType: 'json',
        success: function (data) {
            console.log(data);
            $.each(data, function(i,paths){
                    var status = 'nonFinal';
                    if (paths[0] == '' &amp;&amp; i == 'next'){
                        status = 'suspectFinal';
                    }
                    if (paths[1] == '' &amp;&amp; i == 'next' &amp;&amp; status == 'suspectFinal'){
                        status = 'final';
                        page--;
                        load_pages(page);
                        status == 'nonfinal'
                    }
                    else{
                        if (paths[0] != ''){
                            console.log('method called'); 
                            $('#book').append($('&lt;img&gt;').attr('src',paths[0]).css({'width':'100%','height':'‌​100%','top':1px;}).attr('id','logo-cover'));
                        }

                        if (paths[1] != ''){
                            console.log('method2 called'); 
                            $('#book').append($('&lt;img&gt;').attr('src',paths[1]).css({'width':'100%','height':'‌​100%','top':1px;}).attr('id','logo-cover'));
                        }
                    }
            });
            }
    });
}
    $(document).ready(function(){
    var inputPage = '1';
    if (inputPage == '1'){
        inputPage = '2';
    }

    load_pages(inputPage);
    });

&lt;/script&gt; 
</code></pre>
