English 中文(简体)
恢复吉松岛动态数据
原标题:Retrieve dynamic data over json

I have a logic-thinking problem. I retrieve data from a php file over json and every thing works fine.

但现在我没有什么问题。 我想取一些头条。 主要标题和次标题。 每个主线都有(未知)次标题。

现在,我要把这些头条线全部包装成一个阵列,把头条放在 j上,把主要头条带上另一个颜色作为次线,但次线应在主线下展示。

因此,我应如何把价值观纳入到阵列中,并且不包装这些价值观? 我亲切地履行了每一项职能(为不包装),但现在我确实难以找到成功的解决办法。

希望你们会给我一些背心。

Thanks in advance. Best regards, john

最佳回答

不知道数据结构的全貌:

<?php

$headlines = array(
     title  =>  Headline Title 
     subheadlines  => array(
        array(
             title  =>  Sub Headline Title 
        )
    )
);

?>

我如何构造PHP阵列。

然后使用j Query 美元的功能:

headlines = data.parseJSON();

$.each(headlines, function(i, headline) {

    var headline_title = headline.title;
    var subheadlines = headline.subheadlines;

    $.each(subheadlines, function(k, subheadline) {

        var subheadline_title = subheadline.title;

    });

});
问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签