| <link rel="stylesheet" href="{$mybb->asset_url}/jscripts/select2/select2.css" /> <script type="text/javascript" src="{$mybb->asset_url}/jscripts/select2/select2.min.js"></script> <script type="text/javascript"> <!-- if(use_xmlhttprequest == "1") { MyBB.select2(); $("#sender").select2({ placeholder: "{$lang->find_users}", minimumInputLength: 3, maximumSelectionSize: 3, multiple: false, ajax: { // instead of writing the function to execute the request we use Select2's convenient helper url: "xmlhttp.php?action=get_users", dataType: 'json', data: function (term, page) { return { query: term, // search term }; }, results: function (data, page) { // parse the results into the format expected by Select2. // since we are using custom formatting functions we do not need to alter remote JSON data return {results: data}; } }, initSelection: function(element, callback) { var value = $(element).val(); if (value !== "") { callback({ id: value, text: value }); } } }); } // --> </script>
|