I´m trying to load the content of an xml file into an html element using the JQuery $.get(url, data, callback) method. Here is explicitly the code that I wrote:
function loadFileToElement(filename, elementId) {
var path = filename + ".xml";
var component = document.getElementById(elementId);
try {
$.get(path,
function(data) {
component.innerHTML = data;
});
} catch (e) {
window.alert("Unable to load the requested file " + filename);
}
}
This code works smoothly in IE, but not in Firefox and Google Chrome. By debugging the loadFileToElement() method I figured out that the callback method was not executed. Any Help ? Thanks in advance