2021-02-18|閱讀時間 ‧ 約 1 分鐘

ASP.NET MVC ALERT訊息參考實例

    在controller內加上ShowData["message"]="mvc 測試";
    public ActionResult Login()
    {
    ShowData["message"]="mvc 測試";
    return View();
    }
    view內加上處理判斷
    @{
       if (ShowData["message"] != null)
      {
        script type="text/javascript"
          var message = @Html.Raw(Json.Encode(ShowData["message"]));
          alert(message);
        /script
        }
    }
    分享至
    成為作者繼續創作的動力吧!
    從 Google News 追蹤更多 vocus 的最新精選內容從 Google News 追蹤更多 vocus 的最新精選內容

    發表回應

    成為會員 後即可發表留言