samedi 2 juin 2018

Is there a mistake in this code?

I am using free version of mongoose server. When i click on button btnAutor, nothing happens.

Can someone help me please?

Here is my code:

<head>
    <meta charset="utf-8">
    <title>2 kolokvijum</title>
</head>

<body>

    Unesite ime autora: <input id="imeAutora" type="text" placeholder="Ime autora"><br><br>
    <button id="btnAutor" type="submit" onClick="proveraAutora()">Prikazi</button><br><br>
    <div id="sadrzaj"></div>

    <script src="qwest.min.js"></script>
    <script src="handlebars-v4.0.11.js"></script>
    <script>
        function proveraAutora(){
            var unosAutor = document.querySelector("#imeAutora").value;
            var knjigeTemplate = 
            `
                
                //
                    <h2> </h2>
                    <img src=""></img>
                    <h4>Broj strana: </h4>
                    <h4><b>Cena: </b></h4>
                //
                
            `;

            var divSadrzaj = document.querySelector("#sadrzaj");

            qwest.get("json.json").then(function(xhr, response){
                var Render = Handlebars.compile(knjigeTemplate);
                divSadrzaj.innerHTML = Render({knjige : response});
            });

        };

        Handlebars.registerHelper('equal', function(lvalue, rvalue, options) {
            if (arguments.length < 3)
                throw new Error("Handlebars Helper equal needs 2 parameters");
            if (lvalue != rvalue) {
            return options.inverse(this);
            } else {
                return options.fn(this);
            }
        });
    </script>
</body>

</html>




Aucun commentaire:

Enregistrer un commentaire