lundi 23 octobre 2017

checkbox output in javascript query

We have a few checkboxes of which we want to use the output in a javascript query. We have a few questions about sports and with every question people can check one checkbox, so that these outputs will be sent to the query. The query we have so far is the following:

<script>
    var Q = new sgvizler.Query(); 

    Q.query("SELECT ?sport WHERE { 
        ?sport o:IndividualOrTeam o:Team .
    }      

       .endpointURL("http://localhost/query")

       .endpointOutputFormat("json")                      

       .chartFunction("google.visualization.Table")      
       .draw("myElementID");                              
</script>

Now, what we want is that we can use the output of the checkboxes, which are variables, in our query as input. This would be as follows:

Q.query("SELECT ?sport WHERE { ?sport o:IndividualOrTeam o:[CheckboxOutput1] .

We already used code to check whether a checkbox is checked:

document.getElementById('team').checked;

for all checkboxes, we did the above. We know we can make a var query out of it, but do not know how we can get the variables into this query. I hope someone can help!




Aucun commentaire:

Enregistrer un commentaire