This example show you how to:
<select id="state_id" class="mSelect" multiple="multiple"></select>
$(function () {
$('#state_id').mSelect({
url: 'ajax/example14.php',
data: {'country_id': 123456}, //a country_id which not exist for example
disableIfEmpty: true // disable the mSelect if empty
});
});
<?php
//........
// get the country_id passed via ajax data
$whereAll = null;
if(isset($_GET['country_id']) && !empty($_GET['country_id'])){
$whereAll = "country_id = ".$_GET['country_id']; // make sure to secure the data passed here
}
echo json_encode(
Datatables::complex($_GET, $sql_details, $table, $primaryKey, $columns, $whereResult = null, $whereAll)
);
?>