Select with checkbox

0

Well, my question is, would I have an appointment with the mysql bank and play instead of the cities?

<html>
<head>
    <title></title>

    <link href="http://cdn-na.infragistics.com/igniteui/2017.1/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" />
    <link href="http://cdn-na.infragistics.com/igniteui/2017.1/latest/css/structure/infragistics.css" rel="stylesheet" />

    <script src="http://ajax.aspnetcdn.com/ajax/modernizr/modernizr-2.8.3.js"></script><scriptsrc="http://code.jquery.com/jquery-1.11.3.min.js"></script>
    <script src="http://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script><scriptsrc="http://cdn-na.infragistics.com/igniteui/2017.1/latest/js/infragistics.core.js"></script>
    <script src="http://cdn-na.infragistics.com/igniteui/2017.1/latest/js/infragistics.lob.js"></script></head><body><style>.combo-label{margin-bottom:.5em;}</style><h4class="combo-label">Selecione as matrículas:</h4>
    <div id="checkboxSelectCombo"></div>

    <script>

        var colors = [
            { Name: "Cidades" },
            { Name: "São Paulo" },
            { Name: "Rio de Janeiro" },
            { Name: "Controle" },
            { Name: "Android" },
            { Name: "Maria" },
            { Name: "joão" },
            { Name: "Plus" },
            { Name: "teste" }
        ];

        $(function () {

            $("#checkboxSelectCombo").igCombo({
                width: 300,
                dataSource: colors,
                textKey: "Name",
                valueKey: "Name",
                multiSelection: {
                    enabled: true,
                    showCheckboxes: true
                },
                dropDownOrientation: "bottom"
            });

        });

    </script>

</body>
</html>
    
asked by anonymous 01.08.2017 / 09:46

2 answers

0

use ajax! example:

$.post("insertCidades.php", { cidades: colors }, function(result){
    $("#resultado").html(result); // imprimir o resultado
});

in the insertCities.php

$cidadesArray = $_REQUEST['cidades'];
// agora inserir na base de dados podes usar um while

To test if everything is ok, print_r ($ citiesArray) and in the div with id #resultado will contain the array you sent

    
01.08.2017 / 14:03
0

Follow your updated code, as you requested.

<html>
    <head>
        <title></title>

        <link href="http://cdn-na.infragistics.com/igniteui/2017.1/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" />
        <link href="http://cdn-na.infragistics.com/igniteui/2017.1/latest/css/structure/infragistics.css" rel="stylesheet" />

        <script src="http://ajax.aspnetcdn.com/ajax/modernizr/modernizr-2.8.3.js"></script><scriptsrc="http://code.jquery.com/jquery-1.11.3.min.js"></script>
        <script src="http://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script><scriptsrc="http://cdn-na.infragistics.com/igniteui/2017.1/latest/js/infragistics.core.js"></script>
        <script src="http://cdn-na.infragistics.com/igniteui/2017.1/latest/js/infragistics.lob.js"></script></head><body><style>.combo-label{margin-bottom:.5em;}</style><h4class="combo-label">Selecione as cidades:</h4>
        <div id="checkboxSelectCombo"></div>

        <script>

            $(function () {

                cidades;

                $.get("urlquebuscacidades", function(retorno){
                    /*lá no retorno do .php, deve retornar um objeto ou array, e voce popula sua var no js*/
                    cidades = retorno;
                });

                $("#checkboxSelectCombo").igCombo({
                    width: 300,
                    dataSource: cidades,
                    textKey: "Name",
                    valueKey: "Name",
                    multiSelection: {
                        enabled: true,
                        showCheckboxes: true
                    },
                    dropDownOrientation: "bottom"
                });

            });

        </script>

    </body>
    </html>
    
01.08.2017 / 13:05