ajax之GET示例。
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script type="text/javascript" src="jquery.js"></script>
</head>
<script type="text/javascript">
function GetAllMsg()
{
$("#AllMsg").html(" <img src='images/loading.gif'/>");
$.ajax({
type:'GET',
url:"img.ashx?act=getAll",
dataType:'html', //默认["xml"/"html"] 返回数据类型:["xml" / "html" / "script" / "json" / "jsonp"]
data:"",
success:function(result)
{
$("#DIV002").html(result);
}
});
}
</script>
<body>
<form id="form1" runat="server">
<div id="DIV002">
<input id="Button1" type="button" value="button" onclick="GetAllMsg()"/></div>
</form>
</body>
</html>
<head runat="server">
<title>无标题页</title>
<script type="text/javascript" src="jquery.js"></script>
</head>
<script type="text/javascript">
function GetAllMsg()
{
$("#AllMsg").html(" <img src='images/loading.gif'/>");
$.ajax({
type:'GET',
url:"img.ashx?act=getAll",
dataType:'html', //默认["xml"/"html"] 返回数据类型:["xml" / "html" / "script" / "json" / "jsonp"]
data:"",
success:function(result)
{
$("#DIV002").html(result);
}
});
}
</script>
<body>
<form id="form1" runat="server">
<div id="DIV002">
<input id="Button1" type="button" value="button" onclick="GetAllMsg()"/></div>
</form>
</body>
</html>
Post示例如下: