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 9280117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T17:47:39+00:00 2026-06-18T17:47:39+00:00

I am so confused as to why i am getting duplicate images coming through

  • 0

I am so confused as to why i am getting duplicate images coming through as a result.

here is the code i have on jsfiddle:

http://jsfiddle.net/NyLch/3/

i was thinking maybe it is an async problem, receiving the new pagination before it searches however, what can i do to change that???

thank you

Aiden

  • 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-18T17:47:40+00:00Added an answer on June 18, 2026 at 5:47 pm

    The problem is that the second $.ajax() call is made before the first one ended.

    What you need to do is set a function like this:

    var n = 0, pages = 2;
    function displayImgs(url) {
        $.ajax({
                type: "GET",
                dataType: "jsonp",
                cache: false,
                url: url,
                success: function(data) 
                {
                     alert(data.pagination.next_url);
                     for(var i=0;i<data.data.length; i++)
                     {
                         $("#gallery").append('<img src="'+data.data[i].images.low_resolution.url+'" height="50" width="50">');
                     }
                    n++
                    if(n<pages) displayImgs(data.pagination.next_url);
                }
        });
    }
    

    where n is used only to check the number of times you call the function and pages is the number of pages you want to “load/show”.

    Then you just have to call this function once with the url you have like this:

    displayImgs(url);
    

    and you should get what you want.

    Here is a DEMO.

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

Sidebar

Related Questions

I'm getting confused by pointers in objective-c. Basically I have a bunch of static
Getting confused by syntax here, but what is the difference between: foo[x][y] and foo[x,
I am getting confused here. I am watch an educational tutorial. The speaker defined
I'm getting confused with class inheritance for css. I have this: <ul id='grok'> <li
I am getting confused on how to build the activerecord associations. I have an
I am getting confused with my code and not sure how to implement what
I'm getting confused; I thought I understood INotifyPropertyChanged. I have a small WPF app
I might be getting myself confused here but say I want a service to
I am getting confused with use of self inside blocks, I go through some
Possible Duplicate: Getting an issue while checking the dynamically generated checkbox through list view

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.