I am trying to make an jQuery $ajax GET request to an ASPX-page returning an XML document but is not able to get it to work. What am I doing wrong?
jQuery
$(document).ready(function() {
$("#loading").show();
$.ajax({
type: "GET",
url: "http://www.url.com/reports/xml.aspx",
dataType: "xml",
success: parseXml
});
function parseXml(xml) {
$(xml).find("Year").each(function() {
$("body").append( $(this).find("RevenueYear").text() + '<br />' });
}});
HTML
<!DOCTYPE html>
<html>
<head>
</head>
<body>
</body>
</html>
XML
<root>
<Year>
<RevenueYear>2011</RevenueYear>
<RevenueType>actual</RevenueType>
</Year>
<Year>
<RevenueYear>2012</RevenueYear>
<RevenueType>estimate</RevenueType>
</Year>
</root>