Ô´ÂëÍø,Ô´ÂëÂÛ̳,Ô´ÂëÖ®¼Ò,ÉÌÒµÔ´Âë,ÓÎÏ·Ô´ÂëÏÂÔØ,discuz²å¼þ,ÆåÅÆÔ´ÂëÏÂÔØ,¾«Æ·Ô´ÂëÂÛ̳

 ÕÒ»ØÃÜÂë
 Á¢¼´×¢²á
²é¿´: 300|»Ø¸´: 29

[AJAXÏà¹Ø] ²ËÄñ²ÌÖ®Ajax¸´Ï°µÚÈýƪ(AjaxÖ®ÎÞˢеǼ)

[¸´ÖÆÁ´½Ó]

7Íò

Ö÷Ìâ

861

»ØÌû

32Íò

»ý·Ö

ÂÛ̳ԪÀÏ

Rank: 8Rank: 8

»ý·Ö
329525
·¢±íÓÚ 2012-11-6 09:27:11 | ÏÔʾȫ²¿Â¥²ã |ÔĶÁģʽ
ÎÞˢеǼ´ó¼ÒÒ²Ðíûд¹ý£¬µ«ÊÇÒ»¶¨¶¼ÊÇÌý˵¹ýµÄ£¬ºÜÔçÒÔÇ°¾ÍÏëÓÃÕâ¸öС¼¼ÊõÔÚ×Ô¼º×öµÄСÏîÄ¿ÖÐÓÃÒ»°ÑÁË£¬µ«¶¼Ã»Óи¶³ö¹ýʵ¼ù£¬ÔÚÍøÉϲéҲûÓв鵽¾ßÌåÍêÕûµÄ´úÂ룬ÔÚÕâÀ½ñÌì²ËÄñ²ÌÒ²À´ÊÔÁËÒ»°Ñ£¬Ï׳óÁË£¬Ï£Íû¶Ô³õѧµÄͯЬÓеã°ïÖú ºÃÁË£¬»¹ÊǺÍÒÔÇ°Ò»Ñù£¬ÏȽ¨Ò»¸öLogin.htmlÒ³Ãæ°É£¬ÓÃÓÚÌîдµÇ¼ÐÅÏ¢£¬È»ºóÔÙ½¨Ò»¸öDealData.aspxÒ³Ãæ°É£¨µ±È»£¬ÕâÀïÓÃÒ»°ã´¦Àí³ÌÐòÊÇ×îºÃµÄÁË£º*.ashx£©£¬ÓÃÀ´´¦ÀíÊý¾ÝÓõġ£

ÔÚlogin.htmlÒ³ÃæÖÐÆä´úÂëÈçÏ£º

¸´ÖÆ´úÂë ´úÂëÈçÏÂ:
<head>
<title>ÎÞˢеǼ</title>
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
//ÔªËØ°ó¶¨È«¾ÖajaxStartʼþ
$("#divMsg").ajaxStart(function () {
$(this).show(); //ÏÔʾspanÀïÃæµÄÄÚÈÝ
})
//ÔªËØ°ó¶¨È«¾ÖajaxStopʼþ
$("#divMsg").ajaxStop(function () {
$(this).html("ÇëÇó´¦ÀíÒѾ­Íê³É£¡").hide();
})
$("#btnSure").click(function () {//µã»÷°´Å¥Ê¼þ
var $name = $("#txtName");//»ñÈ¡µÇ¼Ãû
var $pwd = $("#txtPwd");//»ñÈ¡ÃÜÂë
if ($name.val() != "" && $pwd.val() != "") {
//µ÷ÓÃLogin()·½·¨
Login($name.val(),$pwd.val());
} else {
if ($name.val() == "") {//Èç¹ûµÇ¼Ãû²»Îª¿Õ
alert("µÇ¼Ãû²»ÄÜΪ¿Õ£¡");
$name.focus();//»ñÈ¡½¹µã
return false;
} else {
alert("ÃÜÂë²»ÄÜΪ¿Õ£¡");
$pwd.focus();
return false;
}
}
})
})
function Login(name, password) {
$.ajax({
type: "POST", //Êý¾ÝÇëÇóµÄ·½Ê½(post»òget)£¬Ä¬ÈÏΪget
url: "DealData.aspx", //·¢ËÍÇëÇóµÄµØÖ·(ĬÈÏΪµ±Ç°Ò³)
data: "action=Login&date=" + new Date() + "&name=" + name + "&pwd=" + password,//·¢Ë͵½·þÎñÆ÷µÄÊý¾Ý
//µÇ¼³É¹¦ºó·µ»ØµÄÊý¾Ý
success: function (data) {
if (data == "True") {//¸ù¾Ý·µ»ØÖµ½øÐÐÅжϣ¨×¢Ò⣺Tureд³ÉtrueÓ¦¸Ã»á³ö´í°É£¡£©
alert("µÇ¼³É¹¦£¡");
//window.location = "1.htm";ÒªÌøתµÄÒ³Ãæ
} else {
alert("µÇ¼Ãû»òÃÜÂë´íÎó£¡");
return false;
}
}
});
}
</script>
</head>
<body style="text-align:center">
<div>µÇ¼Ãû£º<input type="text" id="txtName" value="" /></div>
<br />
<div>ÃÜ Â룺<input type="text" id="txtPwd" value="" /></div><br />
<div>
<input type="reset" value="È·¶¨" id="btnSure" />
</div>
<span id="divMsg" style="display:none;">ÕýÔÚ·¢ËÍÇëÇó......</span>
</body>
</html>

ÔÚDealData.aspxÖУ¬Æäºǫ́´úÂëÈçÏ£º
¸´ÖÆ´úÂë ´úÂëÈçÏÂ:
public partial class ManageData : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string name = System.Web.HttpUtility.UrlDecode(Request["name"]);//»ñÈ¡µÇ¼Ãû
string pwd = System.Web.HttpUtility.UrlDecode(Request["pwd"]);//»ñÈ¡ÃÜÂë
Response.Write(Login(name, pwd));
Response.End();
}
private bool Login(string name, string pwd)
{
bool result = false;
if (name == "С²Ë" && pwd=="123456")
{
return true;
}
return result;
}
}

ºÃÁË£¬Í¯Ð¬£¬ÄãÒ²¸Ï½ôµÄÊÔһϰɣ¡ÎÞˢУ¬ÄãÒ²ÊÇ¿ÉÒÔµÄ!
»Ø¸´

ʹÓõÀ¾ß ¾Ù±¨

0

Ö÷Ìâ

2Íò

»ØÌû

0

»ý·Ö

Ö춻áÔ±

Rank: 3Rank: 3

»ý·Ö
0
·¢±íÓÚ 2022-9-20 11:24:03 | ÏÔʾȫ²¿Â¥²ã
¶ù·É·É΢·çDVDË­vdsvd

0

Ö÷Ìâ

8878

»ØÌû

0

»ý·Ö

Ö춻áÔ±

Rank: 3Rank: 3

»ý·Ö
0
·¢±íÓÚ 2022-10-18 19:02:34 | ÏÔʾȫ²¿Â¥²ã
žžžÉúÅÂPSPÅÂ

2

Ö÷Ìâ

2Íò

»ØÌû

69

»ý·Ö

×¢²á»áÔ±

Rank: 2

»ý·Ö
69
·¢±íÓÚ 2022-10-29 22:30:58 | ÏÔʾȫ²¿Â¥²ã
³é¸ùÑÌ£¬ÏÂÀ´¿´¿´ÔÙ˵

1

Ö÷Ìâ

2Íò

»ØÌû

307

»ý·Ö

Ö춻áÔ±

Rank: 3Rank: 3

»ý·Ö
307
·¢±íÓÚ 2022-11-16 04:13:25 | ÏÔʾȫ²¿Â¥²ã
ÌìÌìÔ´ÂëÂÛ̳

0

Ö÷Ìâ

1Íò

»ØÌû

0

»ý·Ö

Ö춻áÔ±

Rank: 3Rank: 3

»ý·Ö
0
·¢±íÓÚ 2023-1-13 05:52:10 | ÏÔʾȫ²¿Â¥²ã
ÁËÀÖȤÁËÈ¥ÁËÈ¥ÁËÈ¥ÁËÈ¥ÁË

1

Ö÷Ìâ

1Íò

»ØÌû

93

»ý·Ö

×¢²á»áÔ±

Rank: 2

»ý·Ö
93
·¢±íÓÚ 2023-8-23 02:24:23 | ÏÔʾȫ²¿Â¥²ã
Õâ¸öÔ´Â뻹¿ÉÒÔ

0

Ö÷Ìâ

2Íò

»ØÌû

115

»ý·Ö

×¢²á»áÔ±

Rank: 2

»ý·Ö
115
·¢±íÓÚ 2023-9-11 02:27:45 | ÏÔʾȫ²¿Â¥²ã
È˶¼²»ÔÚÁË°¡ °¡

0

Ö÷Ìâ

2Íò

»ØÌû

120

»ý·Ö

×¢²á»áÔ±

Rank: 2

»ý·Ö
120
·¢±íÓÚ 2023-10-16 03:18:30 | ÏÔʾȫ²¿Â¥²ã
´ó¼Ò¶¼²»ÈÝÒ×£¡

0

Ö÷Ìâ

1Íò

»ØÌû

0

»ý·Ö

Ö춻áÔ±

Rank: 3Rank: 3

»ý·Ö
0
·¢±íÓÚ 2023-11-13 02:43:38 | ÏÔʾȫ²¿Â¥²ã
ÊÕÏÂÀ´¿´¿´ÔõôÑù
¸ß¼¶Ä£Ê½
B Color Image Link Quote Code Smilies

±¾°æ»ý·Ö¹æÔò

ÊÖ»ú°æ|СºÚÎÝ|ÍøÕ¾µØͼ|Ô´ÂëÂÛ̳ ( º£Íâ°æ )

GMT+8, 2024-11-30 05:46 , Processed in 0.081713 second(s), 26 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

¿ìËٻظ´ ·µ»Ø¶¥²¿ ·µ»ØÁбí