[Solved] Javascript code isn’t working. Does anyone know why?


<!DOCTYPE html>
<html>
<head>
    <title>form</title>
</head>
<body>
    <input id="txtQuery" type="text" />
    <button id="btnRequest">Request</button>

    <pre id="txtResponse"><pre>
    <script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
    <script>
    $(document).ready(function(){

            $("#btnRequest").click(function(){
                //Doing a JSON request to wikipedia api
                $.getJSON("https://en.wikipedia.org/w/api.php?action=opensearch&format=jsonfm&search="+ $("#txtQuery").val() + "&namespace=0&limit=10&redirects=resolve&format=json&callback=?", function(data) {
                    $("#txtResponse").html(JSON.stringify(data,null,4));
                });   
            });
    });
    </script>
</body>
</html>

2

solved Javascript code isn’t working. Does anyone know why?