1
這裏是我的代碼: 我從mysql查詢獲取數據並獲取數組值。但我無法填充javasript。能否請您任何一個幫助我......使用Javascript填充PHP數組值
PHP代碼:
$parishFamilyInfo = $parishFamilyInfoBO->sendBirthdayGreeting($personalInfoSearchDO, $parishFamilyInfoSearchDO);
foreach ($parishFamilyInfo as $parishFamily){
if(!empty($parishFamily->email)){
print_r($parishFamily);
}
}
的JavaScript:
$(document).ready(function(){
var t = $('#people').bootstrapTransfer(
{'target_id': 'multi-select-input',
'height': '15em',
'hilite_selection': true});
t.populate([ /*here i need to populate php array value*/
{
value:"<?php print_r($parishFamily->email);?>",
content:"<?php print_r($parishFamily->name);?>"
},
]);
//t.set_values(["2", "4"]);
//console.log(t.get_values());
});
感謝您的時間和信息。 – muralidego
@ user1450403:這個答案解決了你的問題嗎?如果是這樣,請考慮[標記爲*接受*](http://meta.stackexchange.com/a/5235/220538) –