پردازش فایلهای XML با استفاده از jQuery
نویسنده: وحید نصیری
تاریخ: ۱۳۸۷/۱۱/۰۸ ۲۱:۰۰:۲۷
آدرس: www.dntips.ir
| مطالب | ۳۶۹۴ |
| نویسندگان | ۲۷۶ |
| گروههای مطالب | ۱۰۲۴ |
| نقشههای راه | ۱۱۹ |
| دورهها | ۱۴ |
| اشتراکها | ۱۷۹۱۴ |
<rsp stat="ok">
<feed id="fhphjt61bueu08k93ehujpu234" uri="vahidnasiri">
<entry date="2009-01-23" circulation="153" hits="276" reach="10"/>
</feed>
</rsp>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js' type='text/javascript'></script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>FeedBurner API</title>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js' type='text/javascript'>
</script>
<script type="text/javascript">
function parseXml(xml){
//find every entry and print the circulation
$(xml).find("entry").each(function(){
$("#output").append($(this).attr("circulation"));
});
}
$(document).ready(function(){
$.ajax({
type: "GET",
url: "GetFeedData_local.xml",
dataType: "xml",
success: parseXml
});
});
</script>
</head>
<body>
<div dir="rtl" style="font-family:tahoma; font-size:12px;">
تعداد مشترکین تغذیه خبری سایت:
<div id="output">
</div>
</div>
</body>
</html>
function ReadFlagsOnXml(divControlName, XMLFile) {
var div = $("#" + divControlName);
console.log($(div).text());
$.ajax({
type: "GET",
url: XMLFile,
dataType: "xml",
success: function(xml) {
var xmlDoc = $.parseXML(xml),
$xml = $(xmlDoc);
console.log(xml);
var countries = $(xml).find('Countries');
$(countries).find('Country').each(function() {
var countryName = $(this).find('Name').text();
var flagImage = $(this).find('Image').text();
$("<img>", {
src: flagImage,
title: countryName
}).appendTo($(div));
});
}
});
} Cross origin requests are only supported for protocol schemes: http, data, chrome-extension, https, chrome-extension-resource.
Access to restricted URI denied.