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     };
js发送ajax请求:
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 }              
后台响应

 

posted @ 2013-08-16 10:33  爱笑的狐狸  阅读(192)  评论(0编辑  收藏  举报