1
我有一个Model
与LevelInfo
属性:调用JS功能
public IEnumerable<Tuple<string, string, string>> LevelInfo { get; set; }
在视图中我有一个JS功能:
function fillPath(level, color) {
$('[level=' + level).attr({ 'fill': color });
}
现在我想通过LevelInfo
和呼叫迭代fillPath
功能:
$(document).ready(function() {
@foreach (var info in Model.LevelInfo)
{
// How can I call JS function from here?
// i.e, fillPath(info.Item1, info.Item2)
}
});
谢谢。
你想在服务器或客户端调用'fillPath'? – leppie
@leppie:在客户端。 – user1260827