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.
精彩评论