easyui04

easyui04,第1张

1.dialog组件的使用
    类似Bootstrap中的模态框

 
$('#dd').dialog({    
    title: '新增图书',    
    width: 400,    
    height: 250,    
    closed: false,    
    cache: false,    
    href: xPath+'/editBook.jsp',//新增的表单页面    
    modal: true,
    buttons:[{
    text:'保存',
    handler:function(){
        //ajax方法传递数据到servlet中
        $.post("add路径",$("表单id").serialize(),function(data){
            if(data.success){
                $.messager.alert('我的消息','这是一个提示信息!');


            }
        });
    }
    },{
    text:'关闭',
    handler:function(){...}
    }]   
});    
 

2.$("表单id").serialize()
    jQuery中提供的一个方法,可以直接不需要手动获取输入框值,直接打包形成一个url参数拼接。

3.消息框的使用
    $.message.alert();

4.

	$('#dd').dialog({    
		    title: '新增图书',    
		    width: 400,    
		    height: 260,    
		    closed: false,    
		    cache: false,    
		    href: xPath+'/addBook.jsp',    
		    modal: true ,
		    buttons:[{
				text:'新增',
				handler:function(){
					$.ajax({
						url:xPath+"/addBook",
						type:"post",
						data:$('#bookForm').serialize(),//获取表单中的值
						datatype:"text",
						success:function(data){
							let flag=data.message;
							if(flag){
								$.messager.alert('我的消息','新增成功!');
								myload();//刷新界面,
								$('#dd').dialog('close');//关闭界面
							}
						}
					});
				}
			},{
				text:'关闭',
				handler:function(){
					$('#dd').dialog('close');
				}
			}]
		});   

 以上代码d出对话框窗口

url属性引入表单,代码如下


	
	

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/927427.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-17
下一篇 2022-05-17

发表评论

登录后才能评论

评论列表(0条)

保存