开发者

$.ajax load in UI dialog() append issue

开发者 https://www.devze.com 2023-02-07 10:07 出处:网络
I\'m loading data coming from ajax dataType:jsonp into a jquery UI dialog(). The data is displaying by appending the results to <li>

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 开发者_如何学Cget 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消