Trying to load data into a drop down list when a user selects one of two radio buttons. the bookGenres.xml file is in the same directory as my script. I'm out of ideas.
XML:
<?xml version="1.0" encoding="utf-8" ?>
<Genres>
<Fiction>
<book>Sci-Fi</book>
<book>Fantasy</book>
<book>Horror</book>
<book>Romance</book>
<book>Detective</book>
</Fiction>
<NonFiction>
<book>Autobiography</book>
<book>Philosophy</book>
<book>Cooking</book>
<book>Historic</book>
<book>Teaching</book>
</NonFiction>
</Genres>
JQuery:
$('#rblGenre').click( function() {
$('#ddlSpecificGenre > option').remove();
$.ajax({
type: 'GET',
url: 'bookGenres.xml',
dataType: 'xml',
success: function( xml ) {
$(xml).find( $(this).val() ).each( function() {
var subgenre = $(this).find('book').text();
$('#ddlSpecificGenre').append( "<option>" + subgenre + "</option>" );
});
},
error: function() { alert( "WTF" ); }
});
});