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

  • SEARCH
  • Home
  • 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 9231677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:07:50+00:00 2026-06-18T06:07:50+00:00

There is some error in the code below. The rJSON object contains a single

  • 0

There is some error in the code below. The rJSON object contains a single sURL and single iURL(as found by checking in the console.log).
But when the imgList displays after the each condition, it has 3 identical sURL and iURLs in it.

Do you see any issues with this code below?

C.forgotIt = function (page, rJSON) {
    var tempPage = page;
    var imgList = "";

    $.each(rJSON, function (index, value) {
        imgList += "<a href='" + rJSON.sURLS + "'><img class='hsImage' src='" + rJSON.iURLS + "' /></a>";
    });

    page.find('.hsImages').html("<div class='imgListCont'>" + imgList + "</div>");
};

EDIT: rJSON looks like this through console:
{iURLS: Array[1], sURLS: Array[1], RESULT: “OTHER_MEMBER”}

UPDATE: Currently it has one set of iURLS and sURLS but it could display any number of iURLS(and the same number of sURLS)

  • 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-18T06:07:51+00:00Added an answer on June 18, 2026 at 6:07 am

    Most likely rJSON is an object with 3 properties. I already know there are at least 2 properties, sURLS and iURLS, and since it’s iterating three times, there must be a 3rd unused property. (confirmed by edit to OP)

    To get your current code to work, you don’t need the $.each at all because you don’t have an array.

     C.forgotIt = function (page, rJSON) {
         var tempPage = page;
         var imgList = "<a href='" + rJSON.sURLS + "'><img class='hsImage' src='" + rJSON.iURLS + "' /></a>";
         page.find('.hsImages').html("<div class='imgListCont'>" + imgList + "</div>");
     };
    

    Update for your edit:

    you need to use $.each on each property since the properties contain arrays.

     C.forgotIt = function (page, rJSON) {
         var tempPage = page;
         var imgList = "";
         $.each(rJSON.sURLS,function(i) {
             imgList += "<a href='" + rJSON.sURLS[i] + "'><img class='hsImage' src='" + rJSON.iURLS[i] + "' /></a>";
         });
         page.find('.hsImages').html("<div class='imgListCont'>" + imgList + "</div>");
     };
    

    This assumes sURLS and iURLS will always have the same number of items and that they are in the same order.

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

Sidebar

Related Questions

I'm pretty sure there's some quick and easy error in this code but somehow
I get this message when running the code below: There is an error in
I am trying some code but I cannot compile it. is there any error?
Xcode is telling me that there are some problems with the code below in
Is there some code I can add to Jeditable to raise an error if
Below is some of my error logging code. When an exception happens inside my
I'm probably getting mad about it and there must be some trivial error in
Is there a way to make MySQL cause some kind of error when doing
I am trying to post json object {venue:places, US} using below code- HttpClient client
In a code below, there are 2 classes, one is Node and the other

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.