-3

我正在创建一个实时评分网站。关于如何在一个页面上显示我的游戏记分牌,我遇到了难题。我想用来jquery/javascript从文件中提取数据JSON并从中创建多个表。

这是我的JSON文件的内容。

{"basketball_scores":[
    ["basket001","15","12","7","34","10","12","4","26"],
    ["basket002","10","15","5","30","5","10","5","20"],
    ["basket003","3","4","2","9","4","6","10","20"],
    ["basket004","2","6","2","10","5","3","4","12"]
]}

我希望能够创建 4 个自动填充每个游戏的行和列的表。

这是我想显示的方式:

matchup  half1  half2  ot  final 
home     15     12     7   34 
away     10     12     4   26

那将是一张桌子。我想在该领域的其余部分继续这样做。

游戏数量未知,我以 4 为例。

4

2 回答 2

0

Ajax polling is not realtime. Realtime is when something changes in you database, push that data into website, web page or whatever.

  1. some script receives new data
  2. you insert that data into db
  3. you push that data into page

you need Strophe library for this and some php XMPP class if you are using php. Every other language also have libraries for manipulating xmpp messages.

Of course this is easier said then done. This is the book on this metter. If you are looking for finished solution then skip all that I said.

于 2012-12-04T11:40:03.460 回答
0

您应该使用Jquery Ajax来查询您是后端的JSON数据(您想要的),并且您可以success使用jquery.ajax.

于 2012-12-04T05:49:04.497 回答