zoukankan      html  css  js  c++  java
  • Ajax2

    一、完整版Ajax

                $.ajax({
                    url: "Ashxs/Login.ashx",
                    data: { "name": name, "pwd": pwd },
                    type: "post",
                    dataType: "json",
                    success: function (data) {
                        if (data.has == "0") {
                            $("#span_error").text('用户名密码错误!');
                        }
                        else {
                            window.location.href = "HtmlPage2.html";
                        }
                    },//success
                    error: function () { 
                        $("#span_error").text('服务器连接失败!');
                    },//服务器连接不上或是服务器内容有错误时执行
                    beforeSend: function () {
                        $("#txt_username").attr('disabled', 'disabled');
                        $("#txt_password").attr('disabled', 'disabled');
                        $("#btn1").attr('disabled', 'disabled');
                        $("#btn1").val('登陆中...');
                    },//执行ajax时先执行beforeSend再执行其它
                    complete: function () {
                        $("#txt_username").removeAttr('disabled');
                        $("#txt_password").removeAttr('disabled');
                        $("#btn1").removeAttr('disabled');
                        $("#btn1").val('登   陆');
                    }//执行完beforeSend后恢复原状
                });//btn1.ajax
  • 相关阅读:
    【程序2】
    【程序1】
    基数排序
    归并排序
    选择排序
    leetcode15
    leetcode221
    leetcode322
    leetcode921
    leetcode922
  • 原文地址:https://www.cnblogs.com/bosamvs/p/5782023.html
Copyright © 2011-2022 走看看