Retrieving data from Wikia?

191 views Asked by At

I believe it should be possible to retrieve information from another page as long as it's from the same domain right? There are some information that I would like to retrieve from this page, and to display it on another Wikia page. (So that the information can update on its own regularly).

Wikia

Unfortunately, I cannot identify which specific id do I need to retrieve on the Wikia WAM page. I simply don't know how to retrieve the Rank/WAM Score information. Since the WAM Score/Rank updates regularly, the arrow image also changes depending on whether you rose or descended in your rankings. This is why I would like to pull the data from the page so that it can update regularly without having to do it manually.

Is there a way to do this using javascript?

P.S. I apologize for the inconvenience, and to have asked without much knowledge on programming (I only know basic javascript).

1

There are 1 answers

0
T.J. Crowder On

I believe it should be possible to retrieve information from another page as long as it's from the same domain right?

The same origin, which is about more than just domain. This is defined by the Same Origin Policy.

The two pages you asked about are on different origins, http://www.wikia.com and http://asphalt.wikia.com, because the hosts are different even though the TLD is the same. So you won't be able to use ajax to retrieve information on one from the other unless the one you're trying to get the information from shares it with the one you're trying to get it on via Cross-Origin Resource Sharing and you're using a browser that supports it.

If it does support CORS, yes, you can use ajax to query the content of the page, parse it, and extract the information you need.

If not, you might look at using YQL as a cross-origin proxy. Basically that's calling a Yahoo service that uses a server to get the page (so the SOP doesn't come into it), parses it for you, and lets you query against the parsed results.