Twitter bootstrap 3 必须双击才能从MySQL数据库引导3选择库中获取数据

Twitter bootstrap 3 必须双击才能从MySQL数据库引导3选择库中获取数据,twitter-bootstrap-3,bootstrap-select,Twitter Bootstrap 3,Bootstrap Select,我有一个应用程序,它使用Bootstrap 3 Group按钮和Bootstrap select library从MySQL数据库获取一些数据,如下所示: <div class="panel panel-default"> <div class="panel-heading">4 - Select Species <button type="button" class="btn btn-default btn-xs pull-right" id="specicP

我有一个应用程序,它使用Bootstrap 3 Group按钮和Bootstrap select library从MySQL数据库获取一些数据,如下所示:

<div class="panel panel-default">
  <div class="panel-heading">4 - Select Species <button type="button" class="btn btn-default btn-xs pull-right" id="specicPop">?</button></div>
  <div class="panel-body">
  <div class="btn-group"  id="speciesSelect">
      <button id="allspecies" type="button" class="btn btn-default btn-sm">All Species</button>
      <button id="aquatic" type="button" class="btn btn-default btn-sm">Aquatic</button>
      <button id="terrestria" type="button" class="btn btn-default btn-sm">Terrestrial</button>
  </div>
    <select class="selectpicker" id="selectPicker" class="form-control" data-container="body" data-live-search="true">
    <option value="0">Select From The List</option>
 </div>
</div>
PHP部分类似于

if ($result->num_rows > 0) 
    {
    $resultStr.=  '<option value="0">Select From The List</option><option';
        while($row = $result->fetch_assoc())
        {
            $resultStr.=  '<option value="'.$row['id'].'">'.$row['fName'].'</option>';  
        }
    }
    else
    {
        $resultStr = 'Nothing found';
    }
if($result->num\u rows>0)
{

$resultStr.='从列表中选择使用当前浏览器的调试器工具(通常通过Windows上的
F12
可见)

然后将
调试器;
添加到代码中,以查看代码何时执行

$('.btn-group .btn').click(function(){
    // this will pause your execution in your browser
    // and shows you the line
    debugger;
});
这样,您将看到第一次单击是否真的没有触发。 如果不是,您的代码中可能有不同的错误


你有没有其他JS代码可能会破坏你的代码?

看看你的控制台-请求真的不是一次点击就发送的吗?嗨,ChrisWillard,我检查了控制台,但没有显示任何内容!我在第二次点击时得到数据,就像上面说的,但控制台是干净的!嗨,luke,谢谢你的回复,事实上调试器工作正常,我只是想出来了在引导过程中,从Select元素中删除.selectpicker后,Select导致了问题。一切正常!很高兴它帮助了您!
$('.btn-group .btn').click(function(){
    // this will pause your execution in your browser
    // and shows you the line
    debugger;
});