ajax question

Can I use http://199.233.14.22/NHL/2013/stats/ADX-COL-SKED.xml as the url for a ajax connection and how about sportsnetwork.com/NHL.XML I'm in the Domain of sportsnetwork can I use this for data retrieve or am I going to run into cross domain policy issue.
But I maybe wrong but if I use a IP Address and retrieve a xml file why would I get cross domain isn't that a way to beat cross domain I wrote code but I'm not getting two team name as a test. here is code.

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">

var xmlPath = 'http://199.233.14.22/NHL/2013/stats/ADX-COL-SKED.xml'

$(document).ready(function(){
    $.ajax({
        type: "GET",
        url:  xmlPath,
        dataType: "xml",
        success: function(data) {
            var d = $(data);
			var Play = d.find('message');
 d.find('listing').each(function(i,listing){
                var listing=$(listing);
				var awayteam = team.attr("awayteam");
                var hometeam = team.attr('hometeam'); 
				 $('#txthometeam').html(hometeam);
				$('#txtawayteam').html(hometeam);
  });
        }
    });
});

</script>
</head>

<body>
<table width="350" border="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><div align="center" id="txthometeam">Hometeam</div></td>
  </tr>
  <tr>
    <td><div align="center" id="txtawayteam">Awayteam</div></td>
  </tr>
</table>
</body>
</html>

Open in new window

powerztomAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GaryCommented:
As long the domain you are calling by ajax is exactly the same (protocol and address) then there is no problem, if it isn't then you can use Jsonp or a proxy.
IP addresses are not the same as the domain
0
powerztomAuthor Commented:
So IP Address should work right? If so

is this not right cause if I can connect the world will open up for me. There is so much I can retrieve it will be unbelievable.

Tell me what is wrong with this

var xmlPath = 'http://199.233.14.22/NHL/2013/stats/ADX-COL-SKED.xml'
should it be

var xmlPath = '199.233.14.22/NHL/2013/stats/ADX-COL-SKED.xml' but neither one worked for me. Please let me know. cause this is what I get


Error: 0 - [Exception... "Access to restricted URI denied"  code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)"
0
GaryCommented:
Are you loading your webpage using that IP address as well?
Is that IP address mapped to one single domain as a default?

If in the address bar you have http://www.mydomain.com then you have to use http://www.mydomain.com for your ajax call.
0
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

powerztomAuthor Commented:
No the IP Address is remote on a remote computer from the webpage

The IP Address is in  a single domain but when you say is it mapped what do you mean like is it a domain controller or is IP Address have a dns domain name  yes it's name on network is tsnsql22
0
GaryCommented:
Do you have control over that domain/IP?

You can either...
Add an header to that IP
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: http://www.yourdomain.com
Access-Control-Allow-Headers: Content-Type, *

Open in new window

HOw you do this depends on your programming language/server.

Use Jsonp

Or use a proxy - this means you call a page on your own server which in turns calls the above IP for its data and then passes that data back to your page.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
powerztomAuthor Commented:
Gary provided valuable insight regarding my question. Thanks G
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
AJAX

From novice to tech pro — start learning today.