如果结构没有改变,最好使用 JSON 并在本地 JavaScript 中填充。
考虑有一套书。大约 100 个。如果你要输出要更新的 HTML,那肯定会花费很多。同时,您输出的内容如下:
{
success:true,
rows:[{
"id":"1",
"title":"Office Space",
"director":"Mike Judge",
"released":"1999-02-19",
"genre":"1",
"tagline":"Work Sucks",
"coverthumb":"84m.jpg",
"price":"19.95",
"available":"1"
},{
"id":"3",
"title":"Super Troopers",
"director":"Jay Chandrasekhar",
"released":"2002-02-15",
"genre":"1",
"tagline":"Altered State Police",
"coverthumb":"42m.jpg",
"price":"14.95",
"available":"1"
},{
"id":"4",
"title":"American Beauty",
"director":"Sam Mendes",
"released":"1999-10-01",
"genre":"2",
"tagline":"... Look Closer",
"coverthumb":"12m.jpg",
"price":"19.95",
"available":"1"
},{
"id":"5",
"title":"The Big Lebowski",
"director":"Joel Coen",
"released":"1998-03-06",
"genre":"1",
"tagline":"The \"Dude\"",
"coverthumb":"49m.jpg",
"price":"21.90",
"available":"1"
},{
"id":"6",
"title":"Fight Club",
"director":"David Fincher",
"released":"1999-10-15",
"genre":"3",
"tagline":"How much can you know about yourself...",
"coverthumb":"94m.jpg",
"price":"19.95",
"available":"1"
}]
}
这可以很好地被 jQuery.parseJSON 解析并显示为table
or insideli
或 complex div
。