I am making a simple javascript application where I need to load an xml files and show them in front of the user. but my code only works in Mozilla Firefox but when it comes to chrome and Internet Explorer they are not working. I am loading my XML document in a local machine.
$(document).ready(function() {
$('.buttons').slideToggle('medium');
$.ajax({
url: "dictionary.xml",
success: function( xml ) {
$(xml).find("word").each(function(){
$("ul").append("<li>" + $(this).text() + "</li>");
});
}
});
}
And Here's my XML
<?xml version="1.0" encoding="UTF-8"?>
<xml>
<word>
<threeletter>RIP</threeletter>
<fourletter>PIER</fourletter>
<fiveletter>SPIRE</fiveletter>
<sixletter>SPIDER</sixletter>
</word>
<word>
<threeletter>SUE</threeletter>
<fourletter>EMUS</fourletter>
<fiveletter>SERUM</fiveletter>
<sixletter>RESUME</sixletter>
</word>
<word>
<threeletter>COO</threeletter>
<fourletter>CON</fourletter>
<fiveletter>CONDO</fiveletter>
<sixletter>CONDOM</sixletter>
</word>
</xml>
I found the error, here it is
XMLHttpRequest cannot load file:///C:/Users/John/Desktop/JsTwist/dictionary.xml. Origin null is not allowed by Access-Control-Allow-Origin.