How to Use jquery's Ajax function to obtain the website Alexa:
The method for obtaining the website Alexa is actually to use the Ajax function of jquery to obtain a remote XML file and read the specified content.CodeTo obtain the Alexa ranking of the website.
The Code is as follows:
<HTML>
<Head>
<Title> How to Use jquery's Ajax function to obtain website Alexa-PHP self-learning Network </title>
<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>