samedi 2 juillet 2016
I am unable to read data from xml
I have a onclick function in which there is a javascript function that runs to fetch data from xml. it is with jquery. but its not working. help plzzz.
jsp page
<script>
function read() {
$.ajax({
url: "dictionary.xml",
datatype: "xml",
success: function data() {
$("ul").children().remove();
$(data).find("word").each(function () {
var info = '<li>Eng = ' + $(this).find("eng").text() + '</li><li>Beng = ' + $(this).find("beng").text() + '</li>';
$("ul").append(info);
});
}
});
}
</script>
<script src="WEB-INF/js/jquery.min.js" type="text/javascript"></script>
<script src="WEB-INF/js/jquery-2.1.0.min.js" type="text/javascript"></script>
<ul></ul>
<a href="#" onclick="read();">Read</a>
xml file
<?xml version="1.0" ?>
<corporate>
<word>
<eng>Male</eng>
<beng>Man</beng>
</word>
<word>
<eng>Female</eng>
<beng>Woman</beng>
</word>
</corporate>
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire