This is a migrated thread and some comments may be shown as answers.

combobox send a variable to a php file

1 Answer 28 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
jules
Top achievements
Rank 1
jules asked on 31 Aug 2012, 05:09 PM
Hi,

I have a little problem. It's certainly not difficult but i don't find a solution.
I have a combobox with the list of month. Below this combobox i have a grid whiwh is reading the fetch.php
I would select a month in the combo box and send the value to fetch.php (for an example : janvier -> 1) and the grid would be refreshed with this new parameter.
i tried with  :
<h3>Choisissez le mois</h3>
            <input id="input" placeholder="Select fabric..." />
 
            <button class="k-button" id="valid">Valider</button>
         
            <script>
                $(document).ready(function() {
                    // create ComboBox from input HTML element
                    $("#input").kendoComboBox({
                        dataTextField: "text",
                        dataValueField: "value",
                        dataSource: [
                            { text: "Janvier", value: "1" },
                            { text: "Février", value: "2" },
                            { text: "Mars", value: "3" },
                            { text: "Avril", value: "4" },
                            { text: "Mai", value: "5" },
                            { text: "Juin", value: "6" },
                            { text: "Juillet", value: "7" },
                            { text: "Août", value: "8" },
                            { text: "Septembre", value: "9" },
                            { text: "Octobre", value: "10" },
                            { text: "Novembre", value: "11" },
                            { text: "Décembre", value: "12" }
                        ],
                        filter: "contains",
                        suggest: true,
                        index: 0
                    });
 
                    // create ComboBox from select HTML element
                    $("#select").kendoComboBox();
 
                    var input = $("#input").data("kendoComboBox");
 
                    $("#valid").click(function() {
                        $.get("data/fetch.php", { mois:input.value()} );
                        alert(input.value())   
                        });
                    });
            </script>
alert() is ok but $.get doesn't work. If i wrote the $_GET['mois'] in fetch.php the result is ok.
Thanks a lot for your help

1 Answer, 1 is accepted

Sort by
0
jules
Top achievements
Rank 1
answered on 11 Sep 2012, 06:37 AM
Please, how can i do. a little help ?
Tags
ComboBox
Asked by
jules
Top achievements
Rank 1
Answers by
jules
Top achievements
Rank 1
Share this question
or