0

I'm loading data coming from ajax dataType:jsonp into a jquery UI dialog(). The data is displaying by appending the results to <li>

$.each(data.SearchResponse.Image.Results,
    function(i, item) {
        console.log(item.Thumbnail.Url);
        $("#Results").append("<li><img style='width:100px; height:75px;' src='" + item.Thumbnail.Url + "'/></li>");
    });
}

If i have 2 instances of the dialog() open, the first dialog is able to get and append the results where as the second dialog is getting , but not appending the results.

The second case is, If i only have one dialog open, then i'm able to see the results, but if i close it and open it again, results are no longer appended. I do see the results in console.log, but it's just not being appended, why is that.

What is causing this.

1 Answer 1

2

Do you have two divs both with id="Results"? try giving them separate names, or use class="Results" and change #Results to .Results? jQuery only lets you modify the first element if there are two with the same id.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks that did it. I referenced class instead of id and that did it. i'm just wondering why it wasn't working with the one dialog case, where if i first open the dialog it works, but then if i close it then open it, it no longer works. why is dialog counting ID as twice after close and open.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.