zoukankan      html  css  js  c++  java
  • 家庭账本开发day11

    编写登录界面和个人信息查看界面

                $.ajax({
                        url: "UserServlet?method=login",//url
                        type: "post",//方法类型
                        dataType: "text",//预期服务器返回的数据类型 如果是对象返回的是json 如果是字符串这里一定要定义text 之前我就是定义json 结果字符串的返回一直到额error中去
                        data: $('#user').serialize(),//这个是form表单中的id   jQuery的serialize()方法通过序列化表单值
                        success: function (result) {
                            console.log(result);//打印服务端返回的数据(调试用)
                            if (result=="true") {
                                layer.msg('登录成功', function () {
                                    window.location = 'index.html';
                                });
                            }else{
                                layer.msg('用户名或密码有误');
                            }
                        }
                    });

    个人信息

        form.on('submit(info)', function(data){
            $.ajax({
                url:'UserServlet?method=info',
                type:'post',
                dataType: "json",//预期服务器返回的数据类型
                success:function(flag){
                    console.log(flag);
                    console.log(flag.data.username);

                    //var jsonObj = JSON.parse( flag );  
                    //console.log(jsonObj.data.money);
                    document.getElementById("musername").innerHTML=flag.data.username;
                    document.getElementById("mphone").innerHTML=flag.data.phone;
                    document.getElementById("memail").innerHTML=flag.data.mail;
                    document.getElementById("mmoney").innerHTML=flag.data.money;
                    layer.msg("查询成功",{icon:1})
                }
            });
        });

  • 相关阅读:
    sublime3快捷键汇总
    css3百叶窗轮播图效果
    分页特效
    百度评分标准
    兼容问题汇总
    随机彩票
    js 时间函数 及相关运算大全
    JS贪吃蛇游戏
    《Vim实用技巧》阅读笔记 --- 移动及跳转
    《深入理解Linux网络技术内幕》阅读笔记 --- 路由基本概念
  • 原文地址:https://www.cnblogs.com/zhukaile/p/14449191.html
Copyright © 2011-2022 走看看