You got whole bunch of data in textboxes and combo boxes. You retrieve those data by their id using jQuery like so:
1 2 3 |
var temp3 = $('#someID').val(); var temp2 = $('#someiD').combobox('getValue'); var temp = $('#someiD').datebox('getValue'); |
Once you get these data…you pass it into ajax’s data parameter and you’re basically done:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
$('#save_btn').on('click', function() { console.log('save button clicked'); var title = $("#title").val(); var content = $("#content").val(); var requestDate = $('#requestDate').datebox('getValue'); var emergencyLevel = $('#emergencyLevel').combobox('getValue'); var requestSource = $('#requestSource').combobox('getValue'); var callInTel = $("#callInTel").val(); var createUserName = $('#createUserName').val(); var createDatetime = $('#createDatetime').datebox('getValue'); var recordUrl = $("#recordUrl").val(); var remark = $('#remark').val(); var handleStatus = $('#handleStatus').combobox('getValue'); var satisfaction = $('#satisfaction').combobox('getValue'); var callBackStatus = $('#callBackStatus').combobox('getValue'); var requestType = $('#requestType').combobox('getValue'); var requestId = $('#requestId').val(); $.ajax({ url : '${rootPath}/circ/add.json', dataType : 'json', type : 'POST', data : { 'title' : encodeURIComponent(title), 'content' : encodeURIComponent(content), 'requestDate' : requestDate, 'requestType' : requestType, 'emergencyLevel' : emergencyLevel, 'requestSource' : requestSource, 'callInTel' : callInTel, 'createUserName' : createUserName, 'createDatetime' : createDatetime, 'recordUrl' : recordUrl, 'remark' : remark, 'handleStatus' : handleStatus, 'satisfaction' : satisfaction, 'callBackStatus' : callBackStatus }, success : function(data) { if (data.isSuccess) { alert('保存成功!'); console.log('DATA is successful, adding page....!'); } // if } //success function }); //end of ajax }); //end of save button on |