jquery xml, ajax method issue



I'm trying to simply parse xml on my page. I've done this before a number of times with no issue, I can't seem to figure out why it won't work. Any help is much appreciated.


jquery:



$.ajax({
url: 'xml/baht.xml',
dataType: 'xml',
success: function(data) {
$(data).find('item exchangeRate').each(function(){
var baht = $(this).find('value').text();
$('.baht').append(

$('<th />', {
text: baht
})
);

});
},
error: function(){
alert('there was an error');
}
})


xml:



<item>
<exchangeRate>
<value>40.767</value>
</exchangeRate>
</item>


HTML:



<tr class="baht"> </tr>


For some reason, it is not even getting to the xml file.


path:



  • index.html

  • js -> jquery.js, scripts.js

  • xml -> baht.xml


Thanks in advance.


edit: getting the error message when I run the application.


No comments:

Post a Comment