关闭

[置顶] juery ajax语法

标签: ajaxfunctionbuttoninputclassjson
3427人阅读 评论(0) 收藏 举报
                $.ajax({
                    url: "/ForgetCard/ForgetLogin",//方法路径URL
                    data: {
                        strUser: $("#textUser").val(),                   //申请人
                        strForgetDate: $("#txtForgetDate").val(),        //忘记打卡日
                        strLoginDate: $("#txtLoginDate").val(),          //登录日
                        strType: $("#drpType").val(),                    //类型
                        strForgetType: $("#drpForgetCard").val(),        //忘记打卡类型
                        strBeiko: $("#txtBeiko").val(),                  //备注
                        strWitness: $("#drpWiness").val()                  //证明人
                    },//参数
                    dataType: 'json',
                    type: 'POST',
                    async: false,//默认异步调用 false:同步
                    success: function (data) {
                        var retInfo = eval(data);
                        //提交成功
                        if (retInfo == true) {
                            alert("提交成功!");
                            $("#txtForgetDate").val("");        //忘记打卡日
                            $("#txtLoginDate").val("");         //登录日
                            $("#drpType").val("0");                  //类型
                            $("#txtBeiko").val("");                  //备注
                            $(".ForgetCard").css("visibility", "hidden");
                            window.parent.location.reload;
                        }
                    },
                    error: function () {
                        alert('提交数据失败!');
                    }
                })




        $.ajax({
            url: "/HolidayManage/SelectData",
            data: {
                strbmID: function () { return strBmId },           //申请人所在部门CD  
                strUser: function () { return strUser },          //申请人
                strBEGIN_TIME: function () { return strBEGIN_TIME },            //请假起始时间
                strEND_TIME: function () { return strEND_TIME }         //请假结束时间
            },
            dataType: 'json',
            type: 'POST',
            async: false,
            success: function (data) {
                $("#tblView tbody").html("");
                var strTrsContent = "";
                var strTrsContent = "";
                $.each(eval(data), function (n, value) {
                    strTrsContent = "";
                    strTrsContent += "<tr>";
                    //请假单号
                    strTrsContent += "<td  style='width:125px;'>" + value.HOLIDAY_CD + "</td>";
                    //姓名
                    strTrsContent += "<td  style='width:95px;'>" + value.STAFF_NAME + "</td>";
                    //所属部门
                    strTrsContent += "<td style='width:168px;' >" + value.DEP_Name + "</td>";
                    //请假类别
                    strTrsContent += "<td style='width:205px;' >" + value.O_TYPE + "</td>";
                    //开始时间
                    strTrsContent += "<td style='width:180px;' >" + value.O_BEGIN_TIME + "</td>";
                    //结束时间
                    strTrsContent += "<td style='width:180px;' >" + value.O_END_TIME + "</td>";
                    //审批状态
                    strTrsContent += "<td style='width:180px;' >" + value.O_APPROVE_STATE + "</td>";


                    if (value.O_APPROVE_STATE == "待审批") {
                        //操作
                        strTrsContent += "<td style='width:250px'><input type='button' name='" + value.HOLIDAY_CD + "'  id='btnSP'  class='btn' value='审核' ><input type='button' name='" + value.HOLIDAY_CD + "'  class='btn' id='btnDel' value='删除'/></td>";
                    } else {
                        strTrsContent += "<td style='width:250px'><input type='button' name='" + value.HOLIDAY_CD + "'  id='btnSP'  style='display:none'  class='btn' value='审核' ><input type='button' name='" + value.HOLIDAY_CD + "'  style='display:none'  id='btnDel' value='删除'/></td>";
                       
                    }
                    $("#tblView tbody").append(strTrsContent);

                });
            },
            error: function () {
                alert('提交数据失败!');
            }
        });

1
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:149695次
    • 积分:1751
    • 等级:
    • 排名:千里之外
    • 原创:27篇
    • 转载:57篇
    • 译文:0篇
    • 评论:7条
    文章分类
    最新评论