I’ve been working on the Wikipedia viewer and, like others on the forum it would seem, I have been having plenty of trouble with the dreadful docs on the MediaWiki API site.
However, I have persevered and have got my viewer working… well, occasionally. And when it does work, it doesn’t work right.
I’m experiencing two problems that are baffling me. The first is that the API calls only seem to want to work sporadically. As part of my development process I have littered my code with console.log statements and I find that when I try to perform a search I am only meeting with a success maybe 1 in 5 attempts. This doesn’t seem to happen on any of the other projects that I have looked at - has anyone else encountered this problem?
My second problem is that when I do get a successful request, my app is writing the data to the page, but then the page refreshes (I’m assuming it’s an AJAX refresh, but I could be wrong) and the data is lost. It’s incredibly frustrating, because I can see for a split second that my app is working, but then all is lost.
I’d appreciate any thoughts on the issues, as I am very eager to put this one to bed! My code is over at http://codepen.io/lordchancellor/pen/YWwwyq/