1 $.ajax({
2 type: "GET",
3 url: "Login.ashx",
4 dataType: "text",
5 cache: false,//true使用缓存 。 false不使用缓存
6 async: true,//使用 true beforeSend方法会有延迟现象
7 data: { "Method": "Login_User", "dt": JSON.stringify(json) },
8 beforeSend: function () {
9 $('#btn_log').html('正在登陆,请稍后……');
10 $('#btn_log').attr('disabled', 'disabled');
11 },
12 success: function (data) {
13 var json = JSON.parse(data);
14
15 var log = parseInt(json.code);
16 if (log > 0) {
17 window.location.href = "index.html";
18 return false;
19 } else {
20 alert("用户名或密码错误,请重新输入");
21 $('#btn_log').html('登 陆');
22 $('#btn_log').removeAttr('disabled');
23 }
24 },
25 error: function () {
26 alert('网络错误,请检查网络');
27 $('#btn_log').html('登 陆');
28 $('#btn_log').removeAttr('disabled');
29 }
30 });