zoukankan      html  css  js  c++  java
  • 將後台的Json數據返回到前台

    前台JS代碼

    $.post('/Book/GetBookClassIDByName', { BookName: "旅遊手冊" }, function (data) {

                    if (data != 0) {                     if (parseInt($("#BookClassID").val()) == data) {                         $("#dinfo").find("h4").html("旅遊手冊-進階資料");                         $("#trTeamNo").show();

                            //$("#trTeamNo").attr("style", "");                     } else {                         $("#trTeamNo").hide();                         //$("#trTeamNo").attr("style", "display: none");                         $("#dinfo").find("h4").html("代編-進階資料");                     }                 } else {                     $("#trTeamNo").hide();                     //$("#trTeamNo").attr("style", "display: none");                     $("#dinfo").find("h4").html("代編-進階資料");                 }             });

    後台controller代碼:

     public JsonResult GetBookClassIDByName(string BookName)
            {
                int BookClassID = BookClassRepository.getBookClassIdByName(BookName);
                return Json(BookClassID);
                //IEnumerable<int> IbookClassList = BookClassRepository.getBookClassList();
                //return Json(IbookClassList.Where(x => x.ParentID == Pid), JsonRequestBehavior.AllowGet);
            }

  • 相关阅读:
    EF6 AddOrUpdate之后,数据没有改变而是新增了一条数据解决办法
    php多文件上传数组 转换
    windows svn 上传后 自动部署 到web目录下
    一组实用网址
    apache 虚拟ip
    ThinkPHP 空方法 显示
    thinkphp 创建子应用
    Zend Studio 9.0.4 新建项目
    鼠标悬浮停留三秒 显示大图
    mysql GROUP BY 与 ORDER BY 查询不是最新记录
  • 原文地址:https://www.cnblogs.com/qhy1277/p/4686203.html
Copyright © 2011-2022 走看看