使用 JQUERY Mobile 或 javascript 进行数据填充

Data population with JQUERY Mobile or javascript

本文关键字:数据 填充 javascript JQUERY Mobile 使用      更新时间:2023-09-26

在我的应用程序中,我有四个div。我想从 ajax( 以 json 格式)为它们分配各自的数据。另外,如果 Json 响应中有更多项目,我希望它重复填充到相同的div。那么,如何将数据填充到div?

在 AJAX 回调函数中,您可以添加 each 循环。

function(data){
//Populate your four divs here, make sure each time you populate a div to remove that information from your data object so you can do the below loop with the remaining data.
    $.each(data, function(){
    //Create new divs here with .append and populate them with additional data.
    });
}