How to load the xml file content to a div.
Here is my HTML in which I need to load XML content
Try this:
// Load the xml file using ajax
$.ajax({
type: "GET",
url: "something.xml",
dataType: "xml",
success: function (xml) {
// Parse the xml file and get data
var xmlDoc = $.parseXML(xml),
$xml = $(xmlDoc);
$xml.find('category[name="My t"] logo').each(function () {
$("#news-container").append($(this).text() + "
");
});
}
});
Reference: 1. jQuery.ajax() 2. parseXML()