Hi all,
I think the jquery part is correct. But the console report error message. I use atom .
Here is error message. I have ever never see this.
{error: {…}, servedby: “mw1344”}
error
:
{code: “nosearch”, info: “The “search” parameter must be set.”, *: “See https://en.wikipedia.org/w/api.php for API usa… notice of API deprecations and breaking changes.”}
servedby
:
“mw1344”
proto
:
Object
Here is jquery part
$(document).ready(function () {
$('#search'). on('click', function () {
var content = $('#content').val();
var url = 'https://en.wikipedia.org/w/api.php?action=opensearch&search' + content + '&format=json&callback=?';
$.ajax({
url: url,
type: 'GET',
async: false,
dataType: 'jsonp',
success: function (data) {
console.log(data);
},
error: function (errorMessage) {
alert('Error');
}
});
});