Skip to content

Instantly share code, notes, and snippets.

@sixthgear
Forked from anonymous/file.js
Created August 10, 2011 03:16
Show Gist options
  • Save sixthgear/1136013 to your computer and use it in GitHub Desktop.
Save sixthgear/1136013 to your computer and use it in GitHub Desktop.
/*Using JQuery to pull files from italy.xml*/
$(document).ready(function() {
$.ajax({
type: "GET",
url: "xml/italy.xml",
dataType: "xml",
success: handleResponse
});
}); //end ready
function handleResponse(xml) {
var h3 = $("h3");
$("stop", xml).each(function(i, stop) {
var title = $("title", this).text();
$(h3[i]).append(title);
});
}
<!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>
<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