full url here at a guess m8 should fix it
Code:xhttp.open("GET","feed_java.php",false);
We are not familiar with js coding so require some help, at the moment we have the coding working but only if the .js file is called up from the same domain that the main coding is located on, but it just displays a blank page if called up from another domain... any ideas on what we have to do to get it working on any domain?
Here is the .js file
Here is what we are using to call it up...Code:subid = "eecca5b6365d9607ee5a9d336962c534"; uname = "xmlsite"; width = "100%"; if (window.XMLHttpRequest) { xhttp=new XMLHttpRequest() } else { xhttp=new ActiveXObject("Microsoft.XMLHTTP") } xhttp.open("GET","feed_java.php",false); xhttp.send(""); xmlDoc=xhttp.responseXML; title=xmlDoc.getElementsByTagName("title"); voucher_code=xmlDoc.getElementsByTagName("voucher_code"); affiliate_url=xmlDoc.getElementsByTagName("affiliate_url"); merchant=xmlDoc.getElementsByTagName("merchant"); document.write("<table width="+width+"><tr>"); for (i=0;i<5;i++) { link=title[i].childNodes[0].nodeValue; url=affiliate_url[i].childNodes[0].nodeValue; document.write("<td width=20%><a target=_blank href="+url+">"+link+"</a>"); document.write("<br />"); document.write(voucher_code[i].childNodes[0].nodeValue); document.write("<br />"); document.write(merchant[i].childNodes[0].nodeValue); document.write("</td>"); } document.write("</tr></table>");
Here is the output from an external domain... (doesn't work)Code:<script type="text/javascript" src="http://webservices.icodes.co.uk/test_ads5.js"> </script>
http://www.pagerank10.co.uk/test_ads5.html
Here is the output from the domain also hosting the .js file and other main files (works fine)
http://webservices.icodes.co.uk/test_ads5.html
iCodes - Free Voucher and Offer API Available.
full url here at a guess m8 should fix it
Code:xhttp.open("GET","feed_java.php",false);
Poo soz m8 looks like a security issue you can't do it
Ext FAQ Ajax - Learn About the Ext JavaScript Library
You can't do an xmlhttp cross domain - as you've probably realised :-)
This might help
JavaScript Developer Center : Use a Web Proxy for Cross-Domain XMLHttpRequest Calls - YDN
Cheers,
Jon
Leeky (30-10-09)
We actualy had the full url in there orignally but still no luck... so we changed it to what you are seeing now.
But just incase we tried the full url again and no joy!
Could it be our server blocking something / setting needs altering, or just thought.. could it be anything to do with the files located on the sub domain (not sure why that should make a difference as the webservices works fine from it)
Cheers
Lee
EDIT // Posted this at the same time other replies came in.. i'll go check out those links :-)
iCodes - Free Voucher and Offer API Available.
its a browser security issue m8 not your server the browser blocks the request because it comes from a different domian.
If I can think of a way for you to acheive the same result I will shout you.
Leeky (30-10-09)
......forget that, just realised.
(note to self - don't get involved in javascript conversations)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks