I've been going in circles over the last couple of hours over a simple jquery script to parse some survey question data. It's pretty simple but i can't seem to have the information displayed in the dive. Any pointers would be greatly appreaciated.
<?xml version="1.0" encoding="utf-8" ?>
<survey>
<section title="Student Life">
<question num="1" type="radio">
Do you feel the student union represents your interests?
</question>
<question num="2" type="dropDown" value="10">
Please rate your overall satisfaction with the School Bookstore.
</question>
<question num="3" type="radio">
Do you utilize the athletic facilities?
</question>
<html xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Student Survey</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$.ajax({
type: "GET",
url: "surveyQuestions.xml",
dataType: "xml",
success: parseXml
});
});
function parseXml(xml)
{
$(xml).find("section").each(function(){
$("#output").append("<h1>" + $(this).attr("title") + "</h1>");
$(this).find("question").each(function(){
$("#output").append("<h2>" + "question #" + $(this).attr("num") + $(this).find("question").text() +
"</h2>");
)};
)};
}
</script>
</head>
<body>
<div id="output">
Would you like to take a survey?
</div>
</body>
</html>