Reading XML from other domain issue?

Gonesh2011

New Member
I am trying to make livescore website i have done all the work on my localhost perfectly (my XML files was on my local machine) now i am trying to get my XML feeds from a real domain but i can not.i have tried a lot of ways to get response but i failed.First i tried this code:\[code\]$(document).ready(function(){ txt="<ul>"; $.ajax({ type: "GET", url: "http://www.example.com/getfeed/b4998d59890f4280827e3b126a628af0/standings/england.xml", dataType: "xml", success: function(xml){ $(xml).find('team').each(function(){ var sTitle = $(this).attr('name').text(); alert(sTitle); txt=txt +"<li>" + sTitle + "</li>"; }); txt=txt +"</ul>"; document.getElementById('teams').innerHTML=txt; }, error: function() { alert("An error occurred while processing XML file."); } });});\[/code\]but i always get the error message.then i tried :\[code\]function getEngland(){ var url ='http://www.example.com/getfeed/b4998d59890f4280827e3b126a628af0/standings/england.xml'; var xmlhttp,x,i,txt,xx,y; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { x=xmlhttp.responseXML.documentElement.getElementsByTagName("team"); txt="<ul class='countries'>"; for(i=0;i<x.length;i++) { xx=x.getAttribute('name'); txt=txt +"<li><a href='http://stackoverflow.com/questions/14518409/#'>"+ xx +"</a></li>"; } txt=txt +"</ul>"; document.getElementById("popular_countries").innerHTML=txt; } }; xmlhttp.open("GET",url,true); xmlhttp.send();}\[/code\]But xmlhttp.status is always 0.i know that my problem is with dealing the the remote domain but i can not figure out a way to get my XML data from this domain and parse it with ajax, Jquery, Javascript,.......So anybody could help me with that, please??
 
Back
Top