Got the error like "XMLHttpRequest cannot load file:///D:/Roshan%20Task/zobble.xml. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource."
$(document).ready(function(){
$('#getQuestion').click(function(){
console.log('i m here');
$.ajax({
type:"GET",
url:"zobble.xml",
dataType: "xml",
success:function(xml){
$(xml).find('question').each(function(){
var Titles = $(this).find('Title').text();
console.log(Titles);
$("<li></li>").html(Titles ).appendTo("#getQuestion ul");
});
},
error:function(){
console.log('you are out of the xml file');
}
});
});
});
XML File
<?xml version="1.0" encoding="utf-8" ?>
//name the list of Question (url)
<questions>
//Create three cars
<question>
<Title> Spyder </Title>
</question>
<question>
<Title> M3 </Title>
</question>
<question>
<Title> Gallardo </Title>
</question>
</questions>