0

テキストボックスであるSelect2入力があり、このようにします

<input type="text" class="selectbox" name="selectbox['.$row[0].']" />

このようにmysqlから動的に初期値を設定することになっているのですがうまくいきvalue="'.$row[1].'"ません。

select2を設定する私のJqueryは次のとおりです。

 $(".selectbox").select2({
         placeholder: "Search for a Golf Course",
         minimumInputLength: 1,
          ajax: {
                url: "functions/searchGolfCourses.php",
                quietMillis:100,
                dataType: 'json',
                params: {
                method: 'post'
                },
                data: function (term, page) {
                // Data to be sent to the server. Usually it is just the "term"
                // parameter (and page if using pagination).
                // However, since this API simply echoes back what we send,
                return { s: term /* 's' is passed to php as $_POST['s'], this will contains the user input*/
                }
          },
    results: function(data, page) {
        //data param === received response from the server. As dataType
        //is json, jQuery automatically parses the response into an object.
        return { results: data };
    }
  }
});

Select2 入力ボックスの初期値を設定する方法はありますか? 前もって感謝します

4

0 に答える 0