Skip to content

Instantly share code, notes, and snippets.

Created August 9, 2011 20:37
Show Gist options
  • Save anonymous/1135131 to your computer and use it in GitHub Desktop.
Save anonymous/1135131 to your computer and use it in GitHub Desktop.
/*Using JQuery to pull files from italy.xml*/
function sendXMLRequest(){
$(document).ready(function()
{
$.ajax({
type: "GET",
url: "xml/italy.xml",
dataType: "xml",
success: handleResponse
});//end ajax
/* $.ajax({
type: "GET",
url: "../xml/italy.xml",
dataType: "xml",
success: handleResponse
});*/
});//end ready
}//end sendXML
function handleResponse(xml) {
//get pck name
$(xml).find("package").each(function()
{
$("#package").append($(this).attr("title"));
});
//get base price
$(xml).find("package").each(function()
{
total_price = $(this).attr("baseCost");
$("#totalprice").append(total_price);
});
}
<!DOCTYPE html>
<html>
<head>
<!--DO NOT TOUCH -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="file.js" type="text/javascript" charset="utf-8"></script>
<!--END DO NOT TOUCH-->
<link rel="stylesheet" href="css/style.css" />
</head>
<body onload="sendXMLRequest()">
<div data-role="collapsible" data-theme="c" data-collapsed="true">
<h3 id="rome_collapse">=(</h3>
<p>I'm the collapsible content. By default I'm open and displayed on the page, but you can click the header to hide me.</p>
</div>
<div data-role="collapsible" data-theme="c" data-collapsed="true">
<h3 id="florance_collapse">=(</h3>
<p>I'm the collapsible content. By default I'm open and displayed on the page, but you can click the header to hide me.</p>
</div>
<div data-role="collapsible" data-theme="c" data-collapsed="true">
<h3 id="venice_collapse">=(</h3>
<p>I'm the collapsible content. By default I'm open and displayed on the page, but you can click the header to hide me.</p>
</div>
</body>
</html>
<?xml version="1.0"?>
<package title="Italian BlowJobs">
<stop day="1,6,7">
<title>Rome, Italy.</title>
</stop>
<stop day="2,3">
<title>Florence, Italy. </title>
</stop>
<stop day="4,5">
<title>Venice, Italy</title>
</stop>
</package>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment