用jquery ajax获取网站Alexa排名的代码

  作者:bea

代码如下: <html> <head> <title></title> <script type="text/javascript" src="http://img./jslib/jquery/jquery-1.3.2.min.js"></script> <script type="text/javascript"> $(function(){ $("#siteName").b


代码如下:


<html>
<head>
<title></title>
<script type="text/javascript" src="http://img./jslib/jquery/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(function(){
$("#siteName").blur(function(){
$.ajax({
type: "GET",
url: "http://data.alexa.com/data/?cli=10&dat=snba&ver=7.0&url="+$("#siteName").val(),
dataType: "xml",
success: function(xml)
{
$("#count").text($(xml).find("ALEXA SD POPULARITY").attr("TEXT"));
}
})
});
});
</script>
</head>
<body>
<input type="text" id="siteName" />
<span id="count"></span>
</body>
</html>





有用  |  无用

猜你喜欢