Javascript 从Wiktionary API接收单词信息
正如标题中所说,我目前正试图从Wiktionary接收word信息。但是,这种方法不起作用:Javascript 从Wiktionary API接收单词信息,javascript,jquery,html,api,wiktionary,Javascript,Jquery,Html,Api,Wiktionary,正如标题中所说,我目前正试图从Wiktionary接收word信息。但是,这种方法不起作用: <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> <script type="text/javascript"> function
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script type="text/javascript">
function search(){
var a = document.getElementById('search');
var b = document.getElementById('content');
$.ajax({dataType: 'text/html', url: 'http://pl.wiktionary.org/w/index.php?title=' + a.value + '&printable=yes', success: function(data) { b.innerHTML = data; } });
}
</script>
</head>
<body>
<p>
<textarea id="search" rows="1" cols="40" style="resize: none;"></textarea>
<button onclick="search();">Search</button>
</p>
<p id="content">x</p>
</body>
</html>
函数搜索(){
var a=document.getElementById('search');
var b=document.getElementById('content');
$.ajax({dataType:'text/html',url:'http://pl.wiktionary.org/w/index.php?title=“+a.value+”&printable=yes”,成功:函数(数据){b.innerHTML=data;});
}
搜寻
x
当我输入一个单词(例如myszka[小鼠标])时,它不会改变元素的内部内容,控制台也不会显示任何内容。然而,这个查询似乎是有效的,因为当我输入一个不存在的单词时,会出现404错误
这是我明显遗漏了什么,还是
提前感谢有点晚了,但这是波兰维基词典,有波兰语的定义。你确定你想要吗?