zoukankan      html  css  js  c++  java
  • MVC 中用JS跳转窗体Window.Location.href

    一般的Window.Location.href会造成URL地址追加

    较为好的写法为:

    return Content(string.Format("<script type='text/javascript'>alert('请先维护实验前提条件!');window.location.href='{0}'</script>", Url.Action("OfflineLab", "OfflineLab", new { labType = Server.UrlEncode(topic), conditionDesc = unit })));

    ①要是有中文参数的话,需要加 Server.UrlEncode(中文参数)传递到控制器的action中;

    ②接收中文参数的话,则为  string   labType = Server.UrlDecode(labType);

  • 相关阅读:
    九九乘法表
    计算器实现
    分装的日期类
    杨辉三角
    99乘法表
    素数
    java输出100以内质数
    跳台阶
    Counting Sheep
    课上作业
  • 原文地址:https://www.cnblogs.com/yisheng/p/2726801.html
Copyright © 2011-2022 走看看