Ext.Ajax.request
1 function create(){ 2 var itstate = $("#myselect").val(); 3 Ext.Ajax.request({ 4 url: '/servlet/AccountManagement?action=create', 5 params: {itstate: itstate }, 6 method: 'POST', 7 success: function (response,data) { 8 var json = Ext.util.JSON.decode(response.responseText); 9 var msg = json.msg; 10 var flag = json.success; 11 Ext.MessageBox.alert(flag, msg); 12 /**跳转到新建账单页面**/ 13 }, 14 failure: function (response) { 15 var json = Ext.util.JSON.decode(response.responseText); 16 var msg = json.msg; 17 var flag = json.failure; 18 Ext.MessageBox.alert(flag, msg); 19 } 20 }) 21 };
1 JSONObject data = new JSONObject(); 2 try{ 3 data.put("success", "成功"); 4 data.put("msg", "成功生成"); 5 } catch (SQLException e) { 6 data.put("failure", "异常"); 7 data.put("msg", "出现未知异常,账期创建失败"); 8 e.printStackTrace(); 9 }