我有一個PHP數組我想傳遞給我的jQuery(用我的php數組替換測試數組)。將現有的php數組傳遞給jquery
Array
(
[12] => Some Text
[6] => Another text
[11] => one more text
)
的Jquery:
$('#SearchUser').typeahead({
source: [
{ ID: 1, Name: 'Toronto' },
{ ID: 2, Name: 'Montreal' },
{ ID: 3, Name: 'New York' },
{ ID: 4, Name: 'Buffalo' },
{ ID: 5, Name: 'Boston' },
{ ID: 6, Name: 'Columbus' },
{ ID: 7, Name: 'Dallas' },
{ ID: 8, Name: 'Vancouver' },
{ ID: 9, Name: 'Seattle' },
{ ID: 10, Name: 'Los Angeles' }
],
display: 'Name',
val: 'ID',
itemSelected: updateID
});
所以,我怎麼能爲 「源」 的VAR設置爲我的PHP數組?
對此提出建議?
一如既往,你真棒!
-Tom
你可以鏈接到你正在使用的typeahead插件? – ahren 2012-08-07 22:33:20