I am trying to access a store's api and get back an xml response, currently I am using a xmlhttprequest
function GetInfo()
{
var xmlHttp = null;
xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", "http://partner.tcgplayer.com/x2/phl.asmx/p?pk=TCGTEST&s=New Phyrexia&p=Flameborn Viron", false );
xmlHttp.send( null );
alert(xmlHttp.responseText);
}
(jsfiddle here: http://jsfiddle.net/YXRdu/)
but I am not having any success. I feel like it is probably due to the same origin access policy but I am really unsure how to work around it. I have google the problem but I am not sure how I can implement cors on a remote server that I don't have access to. I know the url is valid, when I enter it in my browser I get a xml data back.
I am really unsure what I am doing wrong, any assistance would be appreciated.
Check to see if the server allows JSONP, which works cross-domain. If not, you'll have to get the XML on the server-side (of your own server) and then you can send it to Javascript via AJAX.