<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SeoTest.aspx.cs" Inherits="BookShop.Web.Test.SeoTest" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script src="../js/jquery-1.7.1.js"></script>
<script type="text/javascript">
$(function () {
$("#a1").click(function () {
$.post("/ashx/seo.ashx", {}, function (data) { //用户的请求是通过Ajax。Ajax异步请求,提高用户体验。
$("#div1").append(data);
});
return false; //返回false是为了不再继续执行<a>标签的超链接。
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<a href="/ashx/seo.ashx" id="a1">XXX</a> <!--href属性是为了SEO,让搜索引擎请求该链接,网络爬虫不会爬JavaScript(Ajax)代码-->
<div id="div1"></div>
</div>
</form>
</body>
</html>