Jump to content

Javascript Code to allow XML Feed to appear on webpage!


mdexter

Recommended Posts

Hello all,I have tried so many things to get this to work but to no avail, can someon eplease help me out here with a simple script for n XML steam feed.http://api.steampowered.com/ISteamUserStats/GetGlobalAchievementPercentagesForApp/v0002/?gameid=221380&format=xml OK NOW THE ISSUE IS:I have a blank webpage which I have placed the above link into, I simply want the contents of the XML feed from the link to appear in mypage.......How do I make the contents of that url appear on the same page??SO I NEED THE SMALL SCRIPT OR HTML CODE TO DO THISAlso I would like to have the background a certain colour and use a certain font like 12point arial with bold headings and lower case text.Can someone please provide me with the html to allow this XML feed to appear on my webpage with a different colour background, arial 12pt font inbold and lowercase____________________________________________________________________________I RECEIVED A REPLY TO THIS POST AND THEY ADDED THIS:It's a little hard to tell from what you wrote. But, I think what you are looking for is an AJAX script to pull in the XML,then CSS can take care of the formatting.Look up how to process a XMLHttpRequest in javascript (or another scripting language). That will let you put the XML file into an array. Then,you can use (javascript) document.write() to put the pieces on your page.______________________________________________________________________________SO this being said do I need a javascript code in the page to show the XML Feed with formatting, what would this code be, this is the magicalquestion :) :)Could someone please please help me..........With regardsMathew

Link to comment
Share on other sites

You can't use only Javascript, Javascript cannot load a file from another domain. You need to use something like a PHP proxy, where you have Javascript send a request to a PHP page on your site, the PHP code gets the remote XML code and outputs it, and the response goes back to the Javascript on your site. If you have your PHP script output XML content type headers, then Javascript will know it is XML and will populate the responseXML property with the document structure of the XML data. Do some research into using ajax requests to load XML documents and using an ajax proxy to load remote content. Once you have the file being loaded then you can worry about what to do with it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...