|
復(fù)制代碼 代碼如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>無(wú)標(biāo)題頁(yè)</title>
<script type="text/Javascript" src="jquery/jquery.js"></script>
<script type="text/Javascript">
//這個(gè)方法把a(bǔ)jax方法封裝一下,方便調(diào)用。
function myajax(){
$.ajax({
type:'get',
url:'ajax.ASPx',
data:'',
dataType:'html',
success:callback
});
}
//回調(diào)函數(shù)
function callback(data){
$('#response').append(data);
}
//onload()事件
$(function(){
$('#confirm').click(myajax);
})
</script>
</head>
<body>
<div id="confirm">點(diǎn)擊</div>
<div id="response">接收后臺(tái)數(shù)據(jù)</div>
</body>
</html>
后臺(tái)
復(fù)制代碼 代碼如下:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class ajax : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("hello");
Response.End();
}
}
JavaScript技術(shù):jquery $.ajax入門應(yīng)用一,轉(zhuǎn)載需保留來(lái)源!
鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。