JS获取input框用户输入信息作为数组存储传输给后台数据库操作存储方法

JS获取input框用户输入信息作为数组存储传输给后台数据库操作存储方法

获取input框用户输入信息数组存储

 var datas = {

            Id: idData.id,
            OrderDetailCode: $('input[name="Edit_s_OrderDetailCode"]').val(),
            DeviceCode: $('input[name="Edit_s_DeviceCode"]').val(),
            FactoryArea: $('input[name="Edit_s_FactoryArea"]').val(),
            MachiningLineBody: $('input[name="Edit_s_MachiningLineBody"]').val(),
            Series: $('input[name="Edit_s_Series"]').val(),
            Size: $('input[name="Edit_s_Size"]').val(),
            DateTime: $('input[name="Edit_d_DateTime"]').val(),
            Type: $('select[name="Edit_Type"]').val(),
            Specifications: $('input[name="Edit_s_Specifications"]').val(),
            workOrder: $('input[name="Edit_s_workOrder"]').val(),
            uutType: $('input[name="Edit_n_uutType"]').val(),
            uutName: $('input[name="Edit_s_uutName"]').val(),
            uutCode: $('input[name="Edit_s_uutCode"]').val(),
            serialNumber: $('input[name="Edit_s_serialNumber"]').val(),
            supplier: $('input[name="Edit_s_supplier"]').val(),
            dateCode: $('input[name="Edit_s_dateCode"]').val(),
            lotCode: $('input[name="Edit_s_lotCode"]').val(),
            mould: $('input[name="Edit_s_mould"]').val(),
            cavity: $('input[name="Edit_s_cavity"]').val(),
            colour: $('input[name="Edit_s_colour"]').val(),
            ateName: $('input[name="Edit_s_ateName"]').val(),
            computerName: $('input[name="Edit_s_computerName"]').val(),
            fixuerId: $('input[name="Edit_s_fixuerId"]').val(),
            programName: $('input[name="Edit_s_programName"]').val(),
            programVer: $('input[name="Edit_s_programVer"]').val(),
            uutOperator: $('input[name="Edit_s_uutOperator"]').val(),
            uutOperationSequence: $('input[name="Edit_s_uutOperationSequence"]').val(),
            uutSiteCode: $('input[name="Edit_s_uutSiteCode"]').val(),
            
        }

传输给后台数据库存储

$.ajax({
type: “POST”,
url: “/AjaxPost/UpdateDataAcquisition”,
data: datas,
dealError: false,
success: function (data) {
var data1 = eval("(" + data + “)”);

                if (data1.IsSuccess) {
                    alert("保存修改成功!");
                    //刷新列表
                    //console.log(data);
                    parent.f_flushGrid();
                    parent.f_closeTab("Edit");
                } else {
                    if (data1.Other1 != null)
                        //topsRender.setError(data.Other1);
                        alert("保存修改失败:" + data1.Msgs[0]);
                    console.log(data1.Msgs[0]);
                }

你可能感兴趣的:(项目学习)