Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8951809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:44:52+00:00 2026-06-15T13:44:52+00:00

This is how I add the images inside the <div id = ‘book’>….</div> .

  • 0

This is how I add the images inside the <div id = 'book'>....</div> . Unfourtunely it does not create any img tag as I expected. What is the error? The paths is confirmed contains value .

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

Update:

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…

Whole script

    <script>
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] == '' && i == 'next'){
                        status = 'suspectFinal';
                    }
                    if (paths[1] == '' && i == 'next' && status == 'suspectFinal'){
                        status = 'final';
                        page--;
                        load_pages(page);
                        status == 'nonfinal'
                    }
                    else{
                        if (paths[0] != ''){
                            console.log('method called'); 
                            $('#book').append($('<img>').attr('src',paths[0]).css({'width':'100%','height':'‌​100%','top':1px;}).attr('id','logo-cover'));
                        }

                        if (paths[1] != ''){
                            console.log('method2 called'); 
                            $('#book').append($('<img>').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);
    });

</script> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:44:53+00:00Added an answer on June 15, 2026 at 1:44 pm

    Your posted code is correct, I used it to create this working jsFiddle: http://jsfiddle.net/Ah87q/

    You should check if paths[1] is not null, or you chould find the error somewhere else.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very simple div with an image inside: <div class=stack4> <img src=images/002m.jpg
am working with wallpaper app. In this i add some images in drawable folder
using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
Sorry guys, I posted this earlier today where my add as linked images were
So im making this app where user could add UP to 3 images to
I'm looking to add some content inside an existing div. I'm getting the amount
I am loading images externally using jQuery load function.. but not able add light
i have simple html that looks like this : <div class=img> <a target=_blank href=kl_big.htm
I'm trying to add a class to each div.banner inside of my #destaques, but
OK i am really struggling with this! I know had to add an image

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.