ajax以json格式傳遞json數(shù)據(jù)和數(shù)組數(shù)據(jù)

2018-10-30 16:31 更新

1.js代碼

function update_save(frId,tabId){

    
    var formData = $('#'+frId).serializeArray();
    var brgKeyList = ["bridgeaqttype","bridgeqdtype","bridgezztype","bridgethgrade","bridgedtfzsstype"];
    var bridges =[{"deptcode":"4121091","deptname":"開發(fā)區(qū)住建局","cityname":"許昌市"}];  ;
    var jsonData= {"brgKeyList[]":brgKeyList,"brgeJStr":JSON.stringify(bridges)};

    
    $.ajax({
        url : 'bridge_test.fdo',
        type : "POST",
        data :jsonData,
//      async : false,
        dataType : 'json',
        success : function(returndate, status) {
            debugger;
            dateObj = eval('(' + returndate + ')');
            var flag = dateObj.flag;
            var msg  = dateObj.msg;
            alert('modifyPan',' 修改數(shù)據(jù)',msg);
        }
    });
}

2.java代碼(action層)

public class TBridgeAction{
    private String[] brgKeyList;
    private String  brgeJStr;
    get,set方法省略.....

    
    public String tableModify() throws Exception{
    JSONArray jsonList = JSONArray.fromObject(brgeJStr );

    
    }
}
以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號