标签:splay none server XML utf-8 jquery tst oct 数据
<!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 runat="server">
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
* { margin:0; padding:0;}
body { font-size:12px;}
#loading{
width:80px;
height: 20px;
background:#bbb;
color:#000;
display:none;
}
#resText11
{
border::solid 1px red;
width:100px; font-size:14px;
}
img{border:0;height:100px;width:100px;}
.comment { margin-top:10px; padding:10px; border:1px solid #ccc;background:#DDD;}
.comment h6 { font-weight:700; font-size:14px;}
.para { margin-top:5px; text-indent:2em;background:#DDD;}
</style>
<!-- 引入jQuery -->
<script src="../scripts/jquery-1.3.1.js" type="text/javascript"></script>
<script>
$(function()
{
//demo1:
$(‘#send1‘).click(function()
{
$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=car&tagmode=any&format=json&jsoncallback=?",
function(data)
{
$("#resText1").empty();
$.each(data.items, function( i,item )
{
$("<img/> ").attr("src", item.media.m ).appendTo("#resText1");
if ( i == 3 )
{
return false;
}
});
}
);
});
//demo2:
$("#send2").click(function()
{
$.get("get1.asp",
{
username : $("#username").val() ,
content : $("#content").val()
}, function (data, textStatus)
{
$("#resText2").html(data); // 把返回的数据添加到页面上
}
);
})
//共用这2个全局的ajax事件
$("#loading").ajaxStart(function()
{
$(this).show();
$("#resText11").hide();
$("#resText11").html(" ");
});
$("#loading").ajaxStop(function()
{
$(this).hide();
$("#resText11").show();
$("#resText11").html("图片加载成功");
});
})
</script>
</head>
<body>
<br/>
<div id="loading">加载中.......</div>
<br/>
Demo1:
<br/>
<input type="button" id="send1" value="加载"/>
<div id="resText1" ></div>
<div id="resText11" ></div>
<br/>
Demo2:
<br/>
<form id="form1">
<p>评论:</p>
<p>姓名: <input type="text" name="username" id="username" /></p>
<p>内容: <textarea name="content" id="content" ></textarea></p>
<p><input type="button" id="send2" value="提交"/></p>
</form>
<div class=‘comment‘>已有评论:</div>
<div id="resText2" >
</div>
</body>
</html>
get1.asp
<%@ codepage=65001%>
<%
dim username,content
username=request.QueryString("username")
content=request.QueryString("content")
response.Write("<div class=‘comment‘><h6> "&username&" :</h6><p class=‘para‘> "&content&" </p></div>")
%>
标签:splay none server XML utf-8 jquery tst oct 数据
原文地址:https://www.cnblogs.com/dqh123/p/9470043.html