0
這就是我想要在我看來,要做到:ASP MVC剃刀if語句與JavaScript內
<script type="text/javascript">
@if (ViewBag.scroll != null)
{
console.log("viewbag data: " + @ViewBag.scroll);
}
else
{
console.log("no viewbag data");
}
</script>
我想一些jQuery代碼取決於是否ViewBag
有數據要執行,但它是給我這個錯誤:
the name 'console' does not exist in the current context.
環繞的'console.log'線與' ... '標籤。 –
愚蠢的錯誤,謝謝@Cᴏʀʏ。 – Nick