1

currently i was working with ajax jquery to post data to the php file, I use 'bootstrap selectpicker' to select list of guest which are loaded from the database

<select  name="guest_hidden_id" id="guest_hidden_id" 
  class="selectpicker form-control input-sm guest_hidden_id"  
  data-live-search="true">
</select>

Below are javascript codes

    $("form#post-form").submit(function(event) {
      event.preventDefault(event);          
        var formData = new FormData(this);          
        $.ajax({
            url: 'inc/add_booking.php',
            type: 'POST',
            data: formData,
            async: false,
            success: function (response) {  
               alert(response);
            },
            cache: false,
            contentType: false,
            processData: false
        });

        return false;      
  });

And below statement is how I capture the value

$guest_hidden_id = $_POST['guest_hidden_id'];   
  echo " Guest ID = ".$guest_hidden_id;
4

1 回答 1

0

经过长时间的斗争,我意识到从选项列表中删除“data-tokens”属性后它的工作正常..!

<select class="selectpicker" data-live-search="true">
  <option value=".$row['guest_hidden_id']." data-tokens=".$row['guest_hidden_id'].">....</option>
</select>
于 2017-11-28T06:37:02.633 回答