Whenever I run my code, the table headers appear, but not the table data. I think my XML file may not be loading correctly. I am trying to put my XML file into an HTML table. I've been looking at the code too long and this is also my first project using/ writing XML files so I was wondering if someone else could see what could be wrong with my code. My XML file & HTML file are both in the same folder.
Here is my XML:
<!-- School Number 1 -->
<k12School>
<identification>
<schoolId>0421</schoolId>
<name>Eastside High School</name>
<organizationType>K12School</organizationType>
</identification>
<directory>
<gradesOfferedList>
<gradesOffered xlmns="https://ceds.ed.gov/cedselementdetails.aspx?termid=3131">"09"/"10"/"11"/"12"</gradesOffered>
<gradesOfferedList>
</directory>
<addressList>
<address>
<street>
<line1>1201 SE 43rd St</line1>
</street>
<city>Gainsville</city>
<stateProvince>FL</stateProvince>
<postalCode>32641</postalCode>
<county>Alachua</county>
</address>
</addressList>
<school>
<reference>
<NCESID>101023234576</NCESID>
</reference>
</school>
</k12School>
<!-- School Number 2 -->
<k12School>
<identification>
<schoolId>0591</schoolId>
<name>Oak View Middle School</name>
<organizationType>K12School</organizationType>
</identification>
<directory>
<gradesOfferedList>
<gradesOffered xlmns="https://ceds.ed.gov/cedselementdetails.aspx?termid=3131">"06"/"07"/"08"</gradesOffered>
<gradesOfferedList>
</directory>
<addressList>
<address>
<street>
<line1>1203 SW 250th St</line1>
</street>
<city>Newberry</city>
<stateProvince>FL</stateProvince>
<postalCode>32669</postalCode>
<county>Alachua</county>
</address>
</addressList>
<school>
<reference>
<NCESID>977765431110</NCESID>
</reference>
</school>
</k12School>
<!-- School Number 3 -->
<k12School>
<identification>
<schoolId>0400</schoolId>
<name>FLVS Full-Time 9-12</name>
<organizationType>K12School</organizationType>
</identification>
<directory>
<gradesOfferedList>
<gradesOffered xlmns="https://ceds.ed.gov/cedselementdetails.aspx?termid=3131">"09"/"10"/"11"/"12"</gradesOffered>
<gradesOfferedList>
</directory>
<addressList>
<address>
<street>
<line1>2145 Metrocenter Blvd</line1>
</street>
<city>Orlando</city>
<stateProvince>FL</stateProvince>
<postalCode>32835</postalCode>
<county>Orange</county>
</address>
</addressList>
<school>
<reference>
<NCESID>900000212001</NCESID>
</reference>
</school>
</k12School>
Here is my HTML/Script:
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script>
$(function(){
$.ajax({
type: "GET",
url: "Schools.xml",
dataType: "xml",
success: function(xml){
$(xml).find('identification').each(function(){
var schoolID = $(this).find('schoolID').text();
var name = $(this).find('name').text();
var organizationType = $(this).find('organizationType').text();
$('<tr></tr>').html('<th>' +schoolID+ '</th><td>$' +name+ '</td><td>$' +organizationType+ '</td>').appendTo('#school_data');
});
}
});
});
</script>
<table id = "school_data">
<tr><th>schoolID</th><th>name</th><th>organizationType</th><th>gradesOffered</th><th>street>line1</th><th>city</th><th>stateProvince</th><th>postalCode</th><th>county</th><th>NCESID</th>
</tr>
</table>