js格式化时间为JSON格式 ajax提交 后台处理

var effectRow = new Object();
if ($('#grd_infos').datagrid('getChanges').length) {
    var update = $('#grd_infos').datagrid('getChanges', "updated");
    if (update.length) {
        //var jsonArray = mini.decode(update);
        //var jsonArray =  JSON.stringify(update);
        for (var i = 0; i < update.length; i++) {
            for (var key in update[i]) {

//如果是时间字段
                if (key.toString() == "…" || key.toString() == "…"
                    || key.toString() == "…" || key.toString() == "Time") {
                    update[i][key] = convertDateToJSONDate(update[i][key]);
                }
            }
        }

effectRow["updated"] = JSON.stringify(update);
        }
    }

$.post("/url….", effectRow, function (data) {
                   if (data) {
                       $.messager.alert('', data, 'info');
                       window.open("Machine_Repair", "_self");
                   }
               }, "JSON").error(function () {
                   $.messager.alert("提示", "提交错误了!");
               });

List<Repair_Entry> listUpdated  =new List<Repair_Entry>();

if (Request["updated"] != null && Request["updated"].Trim() != "")
    jsonUpdate = Request["updated"];

if (jsonUpdate != "")
{

listUpdated = JsonDeserialize<List<Repair_Entry>>(jsonUpdate);
}

private T JsonDeserialize<T>(string jsonString)
{
    DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(T));
    MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(jsonString));
    T obj = (T)ser.ReadObject(ms);
    return obj;
}

上一篇:在docker中运行kong和kong dashboard


下一篇:cocos2d-x 3.10 屏幕适配问题