【发布时间】:2019-09-13 14:53:02
【问题描述】:
@foreach (var item in outcode)
{
var outc = item;
if (!codedata.Contains(outc))
{
codedata.Add(outc);
}
else
{
Fun();
}
}
//this is my C# code and here else condition call JavaScript function.
function fun() {
$("table").append('<tr><th><button class="btn btn-secondary" type="button">@Session["dd"]</button> </th> </tr>');
}
// 这是 JavaScript 函数。 以及在剃刀代码中执行 else 条件时调用此函数。
【问题讨论】:
-
你能分享完整的 if/else 语句吗?
标签: javascript c# asp.net-mvc