Ext.setup({ icon:'icon.png', tabletStartupScreen: 'tablet_startup.png', phoneStartupScreen: 'phone_startup.png', glossOnIcon:false, onReady:function () { //
//创建一个Panel控件,在Panel控件中创建一个Button按钮 var panel = new Ext.Panel({ fullscreen: true, //全屏显示 layout: { type: 'vbox', pack: 'center' //显示在Panel控件中的中心 //align: 'stretch'//按钮显示方式,'stretch'为按钮伸长到Panel控件的宽度 }, items: [ //显示内容项 new Ext.Button({ //创建一个按钮 ui: 'decline', // text: 'Ajax', //按钮显示文字 handler: function () { //按钮事件
//创建一个ajax请求对象 var resp = Ext.Ajax.request({ method: "post", headers: { 'Content-Type': 'application/json;utf-8' },
//调用的WebService文件,testAjax就是WebService的方法 url: "../Services/WebService.asmx/testAjax",
//testAjax方法的参数
jsonData: { Name: "测试fnAajxReader方法" }, async: true, //异步执行 success: function (response,opts) { //成功后执行
//得到返回的数据 var sResult = response.responseText; var o = Ext.decode(sResult); Ext.Msg.alert('提示',o['d'],Ext.emptyFn); }, failure: function (response,opts) {//失败后执行 Ext.Msg.alert('提示',response.responseText,Ext.emptyFn); } |