Hi guys, i need yet another help with my project.
So i already made the wikipedia API link using opensearch and it work, it show the json on the browser.
However, when i use it on my code, sometimes it appear but most of the time it didn’t. Especially when i add click or submit function, it just didn’t work, nothing happens. I already tried several click function, but still the same.
Is it the link that is not working or is it the code? Please help me guys, i have search online but still nothing has worked.
$("form").submit(function(){
var searchURL = 'https://en.wikipedia.org/w/api.php?action=opensearch&format=json&search=' + document.getElementById("inputsearch").value + '&limit=10&callback=?';
$.ajax({
url: searchURL,
success: function(data) {
console.log(data[2][1]);
$('p').html(data[2][1]);
},
});
});