2

i am looking to get the value of an xml file on a specific URL address with jQuery.

The link i want to extract it from is: https://en.wikipedia.org/w/api.php?action=query&format=xml&prop=revisions&rvprop=content&rvsection=0&titles=YouTube

My question is: how do i get the value from this XML document (value being the big wall of text).

Thank you very much for your help and time.

1
  • Everything i try gives me this error: <<<No 'Access-Control-Allow-Origin' header is present on the requested resource.>>> Commented May 20, 2016 at 16:55

1 Answer 1

1

Unfortunately this is not possible because of the same origin policy.Basically you're trying to access a resource on the Wikipedia domain but you're making this request from your domain and this is not allowed.

The xml file you're trying to access will only be returned if you're making this request from the Wikipedia domain.

This is a security feature to prevent Cross Site Scripting attacks.Imagine if you're logged in to your facebook account and you visit another website while your session is active and this website has some malicious javascript to send a request to facebook to change your status,post a rude status update or message everyone in your friend list.Same origin policy exists to prevent things like this from happening.It's possible that you do not have any bad intentions but not everyone is that noble.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.