私はModel
withLevelInfo
プロパティを持っています:
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)
}
});
ありがとう。