Ajax unknow error

Hi, the request to api sometimes works and sometimes no works, I don’t undertand what is the problem.

https://codepen.io/sergiosalfer/pen/ZOVaOb

Please help :(, I get the ajax request from this link http://stackoverflow.com/questions/25891076/wikipedia-api-fulltext-search-to-return-articles-with-title-snippet-and-image

I tried to change $.ajax to this and no working too.
$.getJSON("https://en.wikipedia.org/w/api.php?format=json&action=query&generator=search&gsrnamespace=0&gsrsearch=test&gsrlimit=10&prop=pageimages|extracts|info&pilimit=max&exintro&explaintext&exsentences=1&exlimit=max&inprop=url&callback=?", function (data){ console.log("err"); processData(data.query.pages); }); }

This code worked about 3 hours ago and now no.

You need to add event.preventDefault(); at the end of your searchInWiki() function.

As far as I can see, you are not processing received data, it only outputs article id in console.

I can’t see any log in the console, I only receive the error mensaje of ajax.

Is it fault of my computer?

Remove https:// from your codepen address

1 Like

Thanks, now it works!

Change this to https
url: 'https://en.wikipedia.org/w/api.php'
, and u can load pen via https

Also think u need for type prop to set ‘GET’ instead ‘POST’ cause u fetch search data and u nothing change on server side…