Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这样的功能
var json = "location.cities"; $(<--here-->).each(function() { ..... });
所以
我需要将变量“json”放在括号内并触发函数。那么有没有办法做到这一点?请有人帮我解决这个问题吗?我真的被困在这里了。
你可以试试下面的
你一直喜欢"location.cities" 。它现在变成了字符串
"location.cities"
$(location.cities).each(function() { ..... });
或者
var json = location.cities;
$(json).each(function() { ..... });