问题描述
我试图让维基百科文章加载到我的网站。我想在这里按照指示: http://en.wikipedia.org/wiki/Wikipedia :WikiProject_Transwiki 但我无所适从。
我已经试过:
VAR XYZ = document.getElementById(url("http://en.wikipedia.org/w/index.php?title=Special:Export&history=1&action=submit&pages=Albert_einstein")
VAR XYZ = $('#xyz').load('http://en.wikipedia.org/w/index.php?title=Special:Export&history=1&action=submit&pages=Albert_einstein');
文件撰写(XYZ);
如果您使用的是最新的浏览器,你应该能够使用CORS。根据维基百科的API文档,你需要传递一个其它附加原产地
参数相匹配您的浏览器发送的原产地
头
http://en.wikipedia.org/w/api.php
I'm trying to get a wikipedia article to load onto my site. I'm trying to follow the instructions here: http://en.wikipedia.org/wiki/Wikipedia:WikiProject_Transwiki but I'm at a loss.
I've tried:
var xyz = document.getElementById(url("http://en.wikipedia.org/w/index.php?title=Special:Export&history=1&action=submit&pages=Albert_einstein")
var xyz = $('#xyz').load('http://en.wikipedia.org/w/index.php?title=Special:Export&history=1&action=submit&pages=Albert_einstein');
document.write(xyz);
If you are using a modern browser, you should be able to use CORS. According to the Wikipedia API docs, you need to pass an additionnal origin
parameter that matches the Origin
header sent by your browser.
http://en.wikipedia.org/w/api.php
这篇关于我如何可以加载从其他网站的内容到矿用JavaScript / jQuery的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!