开发者

Passing json object to jquery ui function for dynamically adding <option> tag from php

I am really new to jquery UI and what i need to do is to pass a json object i am getting from facebook's g开发者_StackOverflow社区raph api

$pageIds=$facebook->api('/me/accounts');

Now i need to pass $pageid to the jqueryUI function to dynamically add to the tag by

$('#list').append($("<option></option>").
              attr("value",key).
              text(value);

how can i do this?


In a .php file, do:

foreach ( $pageIds as $pageid ) {
    ?>
    $('#list').append($("<option></option>").
          attr("value", <?php echo $pageid; ?> ).
          text(value);
    <?php
}

This outputs the jquery syntax for appending the options.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜