zoukankan      html  css  js  c++  java
  • ajax请求数据格式

    type是请求的类型包含了get和post

    url:请求的地址

    data:传递的参数

    dataType :数据格式,可以是html,json

    返回成功之后进入到success 函数

    返回失败之后进入到error函数

     <script type="text/javascript">

            function doLogin(type) {
                $.ajax({
                    type : "GET",
                    url : "login.do",
                    data : {
                        username : $("#username").val(),
                        password : $("#password").val(),
                        type : type
                    },
                    dataType : "json"//预期服务器返回的数据
                    success : function(data) {
                        if (data.errCode < 0) {
                            alert("登录失败!")
                            $("#errMsg").show().html(data.errMsg).stop(truetrue)
                                    .fadeOut(3000);
                        else {
                            //登录成功,做其他处理
                            alert("恭喜你,登录成功!");
                        }
                    }
                });
            }
        </script>
    转载博客:https://www.cnblogs.com/1906859953Lucas/p/10828801.html

    本文来自博客园,作者:.net&new,转载请注明原文链接:https://www.cnblogs.com/wugh8726254/p/12644202.html

  • 相关阅读:
    C# 中的类型转换
    Structured Query Language 入门 oracle
    C# 模板代碼的總結
    .net 頁面通過C#控件綁定時間格式的方法
    醫務室系統報表中使用的一個使用遊標的自定義方法 sqlserver
    vi 编译器的退出
    和为s的数字
    两个链表的第一个公共节点
    某数字在排序数组中出现的次数
    二叉搜索树的第k个节点
  • 原文地址:https://www.cnblogs.com/wugh8726254/p/12644202.html
Copyright © 2011-2022 走看看