Projekt

Obecné

Profil

« Předchozí | Další » 

Revize d9606f0d

Přidáno uživatelem Tomáš Pašek před asi 4 roky(ů)

Feature #8345 Implementce filterů dat - Server

Zobrazit rozdíly:

application/view/Index.php
6 6
    function doSearch () {
7 7
        // (A1) GET SEARCH TERM
8 8
        var data = new FormData();
9

  
10
        // (A2) AJAX - USE HTTP:// NOT FILE://
9
        //data.append("manuscript", "0,3"); //příklad pro filtraci manuscriptů, asi se ještě uprav
10
        data.append("page", "0");
11
        data.append("items_per_page", "50");
12
        //data.append("finished", "false");
13
        // data.append("tag_pos", "V");
14
        // data.append("tag_verb_aspect", "P");
15
        // data.append("tag_number", "S");
16
        // data.append("word", "okáza");
11 17
        var xhr = new XMLHttpRequest();
12 18
        xhr.open("POST", "../controller/TableController.php");
13 19
        xhr.onload = function(){
14 20
            let results = document.getElementById("results"),
15
                search = this.response;
21
                search = JSON.parse(this.response);
16 22
            results.innerHTML = "";
17 23
            console.log(search);
18
            let parsedJSON = JSON.parse(search);
19
            console.log(parsedJSON);
20
            if (parsedJSON != null) { for (let s of parsedJSON) {
21
                results.innerHTML += "<div>" + s.id + "</div>";
22
            }}
23 24
        };
24 25
        xhr.send(data);
25 26
        return false;

Také k dispozici: Unified diff