<div id="logreg">
 <form id="logForm" method="post">
 用户名:<input type="text" name="name"/>
 密码:<input type="password" name="password"/>
 </form>
 </div>
var loginReg;
$(function(){
loginReg=$('#logreg').dialog({
    title: '登录',
    width: 400,
    height: 200,
    closed: false,
    cache: false,
   // href: 'get_content.php',
    modal: true,
    buttons : [
        {
            text:'注册',
            handler:function(){}
        
        },{
            text:'登录',
            handler:function(){
                
                $.ajax({
                    url : 'userController.do?login',
                    data : {
                        name : $('#logForm input[name=name]').val,
                        password : $('#logForm input[name=password]').val
                    },
                    cache:false,
                    dataType:'json',//fanhui
                    //huidiao
                    success:function(r){
                        alert(r.msg);
                    }
                
                });alert("111");
                
            }
        
        }
    
    
    ]
});

});

登录的后台代码,通过ajax

posted on 2014-04-17 01:03  xxyyjj  阅读(173)  评论(0编辑  收藏  举报