I have an issue where I am simply trying to make an ajax call to an xml file that is in the parent folder of my js file. I was led to believe the issue was my URL.
When the url was "../a2.xml" I would get an error of being unable to load resource. I then changed it to "a2.xml" and this does not give me that same error yet the call still does not reach the success function.
jquery code:
$(document).ready(function(event)
{
console.log("Before ajax call.");
$.ajax
({
url:'a2.xml',
type:'GET',
dataType:'xml',
success: function(data)
{
console.log("Success");
//var varxmldoc = data
//var name = $(xmldoc).find('studentName').text();
//body = '<h1>'+name+'</h1><hr>';
//$(body).appendTo('div');
}
});
});
Aucun commentaire:
Enregistrer un commentaire