zoukankan      html  css  js  c++  java
  • 动态路由接收前台传值

    前台JS 代码
    function ExportStudent() { var selectId = $("#selectId").val(); var gradeId = $("#gradeId").val(); var classId = $("#classId").val(); var courseId = $("#courseId").val(); var currentCount = parseInt($("#totalnum").html()); if (currentCount > 0) { window.location.href = "/EnrollResult/ExportExcel/" + selectId + "/" + gradeId + "/" + classId + "/" + courseId; //alert("/EnrollResult/ExportExcel/" + selectId + "/" + gradeId + "/" + classId + "/" + courseId); } else { showErrorTips("当前查询条件下没有可导出的选课信息"); } } 

      后台代码

    当参数classid 为空,courseId 不为空时,后台查不到数据,经断点跟踪发现 后台路由结束值时,classId接到得是courseId的值,因此查不到数据

    查找原因:

    输出 前台url 地址  

     发现classId 为空时,courseId成为第三个参数,

    解决办法:判断classId是否为空,给classId赋值,后台做判断。

    function ExportStudent() {
        var selectId = $("#selectId").val();
        var gradeId = $("#gradeId").val();
        var classId = $("#classId").val();
        if (classId == "")
        { classId = 1;}
        var courseId = $("#courseId").val(); 
        var currentCount = parseInt($("#totalnum").html());
        if (currentCount > 0) {
            window.location.href = "/EnrollResult/ExportExcel/" + selectId + "/" + gradeId + "/" + classId + "/" + courseId;
            //alert("/EnrollResult/ExportExcel/" + selectId + "/" + gradeId + "/" + classId + "/" + courseId);
        }
        else {
            showErrorTips("当前查询条件下没有可导出的选课信息");
        }
    }
  • 相关阅读:
    MAC下cocos2dx环境搭建
    eclipse混淆打包出错
    eclipseme升级
    MyEclipse 10 中增加插件
    j2me图片处理大全
    关于svn使用
    NFS相关
    BMP文件格式图解
    UDA1341TS
    OpenOCD初始化脚本(uboot)
  • 原文地址:https://www.cnblogs.com/NKing/p/7697986.html
Copyright © 2011-2022 走看看