Wednesday, 4 February 2015

Ajax Get Url is not Responding



I'm trying to get some XML file from the net and i need to display that in my html page...... This is how my javascript file looks like:



$(document).ready(function(){
$(".update").append("<ul></ul>");
$.ajax({
type: "GET",
url: "http://ift.tt/1F7OaY1",
dataType: "xml",
success: function(xml){
$(xml).find('slide').each(function(){
var sTitle = $(this).find('title').text();
//var sPublisher = $(this).find('heading').text();
$("<li></li>").html(sTitle + ", " + "sPublisher").appendTo(".update ul");
});
},
error: function() {
alert("An error occurred while processing XML file.");
}
});
});


When i try to run this using this URL the browser gives an error saying "An error occurred while processing XML file"........................ But if i download the XML File and write it as following.... It will run the page without any errors.......



$.ajax({
type: "GET",
url: "data.xml",
dataType: "xml",
...................................


I also tried to use another online XML File same thing happened...... Anyone has an idea how to solve this??? Thank You!!!!!


No comments:

Post a Comment