This site uses cookies from Google to deliver its services, to personalize ads and to analyze traffic. Information about your use of this site is shared with Google. By using this site, you agree to its use of cookies. Learn More

Read Xml With Jquery/ajax

Read Xml With Jquery/ajax Web-development (jquery) Read Xml With Jquery/ajax Read XML with jQuery/Ajax
Read XML with jQuery/Ajax




<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script>
<script>
$(document).ready(function () {
$.ajax({
type: "GET",
url: "music.xml",
dataType: "xml",
success: function_Parsxml
});
});
function function_Parsxml(xml) {
$('#load').fadeOut();
$(xml).find("mostplayedsongs").each(function () {

$(".main").append('<div><div>' + $(this).find("Title").text() + '</div> <div>' + $(this).find("Artist").text() + '</div></div>');
$(".song").fadeIn(1000);
});
}
</script>
<style>
.main{
width:100%;
margin:0 auto;
height:130px;
}
.song{
width:208px;
float:left;
margin:10px;
border:1px #dedede solid;
padding:5px;
display:none;
}
.title{
margin-bottom:6px;}
.Artist{font-size:12px; color:#999; margin-top:4px;}
.loader{
height:11px;
}
</style>

<div>
<div align="center"><img src="loader.gif" width="16" height="11" align="absmiddle"/></div>
</div>



music.xml

<?xml version="1.0" encoding="utf-8" ?>
<musictype>
<mostplayedsongs>
<Title>Sexyback</Title>
<Artist>Timberlake, Justin</Artist>
</mostplayedsongs>
<mostplayedsongs>
<Title>Wonderful Tonight</Title>
<Artist>Clapton, Eric</Artist>
</mostplayedsongs>
<mostplayedsongs>
<Title> Amazed</Title>
<Artist>Lonestar</Artist>
</mostplayedsongs>

</musictype>

0 Response to "Read Xml With Jquery/ajax"

Posting Komentar

Contact

Nama

Email *

Pesan *