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)
Most likely rJSON is an object with 3 properties. I already know there are at least 2 properties,
sURLSandiURLS, 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.
Update for your edit:
you need to use $.each on each property since the properties contain arrays.
This assumes
sURLSandiURLSwill always have the same number of items and that they are in the same order.