Wiki Finder Deep trouble

<!DOCTYPE html>
<script src=""></script>
<link href="" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="Wiki.css">
<script src = "Wiki.js"></script>

<input id="input" type="text" size="40">
<button class="button button1" id = "getSearch" > Search</button>
<div id="output"> </div>


//Run some JQuery
    //When search is clicked run code
$("#getSearch").click(function(){//button reacts to click
    //get search input
    var input = $('#input').val();// <input> reacts to what is typed.
    //complete api
    var html = "*&srsearch="
    + input; //complete url

            dataType: 'json',
            type: 'get',
            success: function(data){

                for (var i = 0; i < data[1].length; i++){
                    $("#output").prepend("<div class='jumbotron'><li><a href='"+ data[3][i] + "'>"+ data[1][i] + "</a><p>\n" + data[2][i] + "</p></li></div>");



Above is my html and javascript code for the wiki finder. However, i cannot get it to work properly no matter what i do. It keeps giving me the same search result for “lol” no matter what. I’m deeply confused here, and help would be extremely appreciated.

I think your problem is here…
var html = “*&srsearch=

you’ve set your search criteria “search=lol”. I believe u should use a variable

I cleaned up your code.
You need to use triple backticks to post code to the forum.
See this post for details.

I notice a couple of things. First, the input tag is self-closing. I doubt this is causing your problem, but:

<input id="input" type="text" size="40" /> <!-- notice the / -->
<button class="button button1" id = "getSearch" > Search</button>
<!-- remove the closing </input> -->

Second, you’ve hard coded “lol” as your search parameter in your URL.

"...action=opensearch& >> search=lol << &format=json&origin=*&srsearch="

Thank you ! No matter how many times i read it, i couldn’t see that lol was hard coded, what a turn of events. I thought i was going crazy!

You are absolutely right…thanks for taking the time to find that.

1 Like