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

其实就是利用了jqueryajax功能,获取远程的xml文件,读取指定内容的代码,对于学习jquery的朋友是个不错的参考。

复制代码 代码如下:


<html>
<head>
<title></title>
<script type="text/javascript" src="https://img.jb51.net/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" />
<span></span>
</body>
</html>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wdpxjg.html