Extjs ajax读取 intraweb数据
自己搞定,备忘。 前台代码: Ext.onReady(function(){ new Ext.FormPanel({ id:'typeForm', renderTo: Ext.getBody(),宋体; font-size:14px; line-height:20px"> frame: true,宋体; font-size:14px; line-height:20px"> height: 300,宋体; font-size:14px; line-height:20px"> width:452,宋体; font-size:14px; line-height:20px"> buttonAlign:"center",宋体; font-size:14px; line-height:20px"> labelWidth: 50,宋体; font-size:14px; line-height:20px"> title: '函数',宋体; font-size:14px; line-height:20px"> items: [ { xtype:'textareafield',宋体; font-size:14px; line-height:20px"> id:'myText',宋体; font-size:14px; line-height:20px"> height: 200,宋体; font-size:14px; line-height:20px"> width: 450,宋体; font-size:14px; line-height:20px"> wordWrap : true },宋体; font-size:14px; line-height:20px"> new Ext.Button({ text:'...发送Ajax请求',宋体; font-size:14px; line-height:20px"> listeners:{ "click":function(){ Ext.Ajax.request({ url: '/$/callback?callback=IWCallBack1',//重点 method: 'POST',宋体; font-size:14px; line-height:20px"> success: function (response,options){ Ext.MessageBox.alert('成功','从服务端获取结果: ' + response.responseText); Ext.getCmp("myText").setValue(response.responseText); },宋体; font-size:14px; line-height:20px"> failure: function (response,宋体; font-size:14px; line-height:20px"> Ext.MessageBox.alert('失败','请求超时或网络故障,错误编号:' + response.status); } }); } },宋体; font-size:14px; line-height:20px"> })
],//最大的ITEMS }); }); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 后台intraweb代码: procedure TIWForm1.IWAppFormCreate(Sender: TObject); begin LayoutMgr := IWTemplateProcessorHTML1; WebApplication.RegisterCallBack('IWCallBack1',DoCallBack1); //重点 end; procedure TIWForm1.DoCallBack1(EventParams: TStringList); WebApplication.CallBackResponse.AddTagToUpdate('我是返回的数据,哈哈哈,搞定了哦!!'); //重点 end; 这个测试的意义是,可以用Extjs的强大功能做前台界面,intraweb只做后台,用ajax请求读取数据,摆脱对iw控件的依赖,可以把前后台分开(IW控件都是把前后台以及ajax封装在一起的)。 可以看到intraweb ajax Response返回的是XML。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |