I am using the below code to read one xml file which is located locally. But its not displaying the object of xmldoc. My code is
function loadXMLDoc(XMLname)
{
Better use Jquery function. Its working fine for me.
<script src="jquery.js" type="text/javascript"></script>
<script>
$(document).ready(function(){
$.ajax({
type: "GET",
url: "read2.xml",
dataType: "xml",
success: function(xml) {
$(xml).find('site').each(function(){
var id = $(this).attr('id');
var title = $(this).find('title').text();
var url = $(this).find('url').text();
$(this).find('desc').each(function()
{
var brief = $(this).find('brief').text();
var long = $(this).find('long').text();
alert("my "+brief );
alert("my "+long );
});
});
}
});
});
And the XML file format will be
my title1 url1
brf 1 long 1
brf 2 long 2