开发者

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

开发者 https://www.devze.com 2023-04-03 10:18 出处:网络
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

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

精彩评论

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