- /**
- *<p>
- *第一种Ajax提交方式
- *</p>
- *<p>
- *这种方式需要直接使用extAjax方法进行提交
- *</p>
- *使用这种方式,需要将待传递的参数进行封装
- *
- *@return
- */
- functionsaveUser_ajaxSubmit1(){
- Ext.Ajax.request({
- url:'user_save.action',
- method:'post',
- params:{
- userName:document.getElementById('userName').value,92); line-height:18px"> password:document.getElementById('password').value
- },
- success:function(response,options){
- varo=Ext.util.JSON.decode(response.responseText);
- alert(o.msg);
- failure:function(){
- }
- });
- /**
- *第二种Ajax提交方式
- *这种方式将为ext的ajax指定一个html表单
- *使用这种方式,不需要将待传递的参数进行封装
- *
- *@return
- */
- functionsaveUser_ajaxSubmit2(){
- Ext.Ajax.request({
- url:'user_save.action',92); line-height:18px"> method:'post',255); line-height:18px"> form:'userForm',//指定表单
- *第三种Ajax提交方式
- *这种方式将为ext的自己的表单进行提交
- *使用这种方式,需要使用ext自己的textField组件
- functionsaveUser_ajaxSubmit3(){
- //定义表单
- varformPanel=newExt.FormPanel({
- labelWidth:75,255); line-height:18px"> frame:true,92); line-height:18px"> bodyStyle:'padding:5px5px0',255); line-height:18px"> width:350,92); line-height:18px"> defaults:{
- width:230
- },
- defaultType:'textfield',92); line-height:18px"> items:[{
- fieldLabel:'用户名',92); line-height:18px"> name:'userName',255); line-height:18px"> allowBlank:false
- ottom:0px!important; margin-left:0px!important; padding-top:0px!important; padding-right:3px!important; padding-bottom:0px!important; padding-left:10px!important; border-top-style:none; border-right-style:none; border-bottom-style:none; border-left-style:solid; border-width:initial; border-color:initial; list-style-type:decimal-leading-zero; list-style-position:outside!important; border-left-width:3px; border-left-color:rgb(108,{
- fieldLabel:'密码',92); line-height:18px"> name:'password'
- }]
- //定义窗口
- varwin=newExt.Window({
- title:'添加用户',92); line-height:18px"> layout:'fit',255); line-height:18px"> width:500,92); line-height:18px"> height:300,255); line-height:18px"> closeAction:'close',92); line-height:18px"> closable:false,255); line-height:18px"> plain:true,92); line-height:18px"> items:formPanel,255); line-height:18px"> buttons:[{
- text:'确定',255); line-height:18px"> handler:function(){
- varform=formPanel.getForm();
- varuserName=form.findField('userName').getValue().trim();
- varpassword=form.findField('password').getValue().trim();
- if(!userName){
- alert('用户名不能为空');
- return;
- }
- if(!password){
- alert('密码不能为空');
- form.submit({
- waitTitle:'请稍后...',255); line-height:18px"> waitMsg:'正在保存用户信息,请稍后...',92); line-height:18px"> success:function(form,action){
- alert(action.result.msg);
- failure:function(form,action){
- alert(action.result.msg);
- text:'取消',92); line-height:18px"> handler:function(){
- win.close();
- win.show();
- *第四种Ajax提交方式
- *这种方式将html的表单转化为ext的表单进行异步提交
- *使用这种方式,需要定义好html的表单
- functionsaveUser_ajaxSubmit4(){
- newExt.form.BasicForm('userForm').submit({
- }
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。