View Utama
<div class="fitem">
<label>Provinsi:</label>
<select class="easyui-combobox" name="provinsi" id="provinsi" required="true" >
<option value="<?php echo isset($_POST['provinsi']) ? $_POST['provinsi'] : ''; ?>"></option>
<?
foreach ($provins as $provinss) {
?>
<option value="<?= $provinss['IDProvinsi']; ?>"><?= $provinss['NamaProvinsi']; ?>
</option>
<?php
}
?>
</select>
</div>
<div class="fitem" name="kotalook">
<label>Kota:</label>
<label id="kotalook"> </label>
</div>
javascript onchange jeasyui
$('#provinsi').combobox({
onChange: function(){
$.ajax({
type: "POST",
url : "<?php echo site_url('tiket/getkota') ?>",
data: {provinsi:$('#provinsi').combobox('getValue')},
success: function(msg){
$('#kotalook').html(msg);
}
});
}
});
View Onchange
<select name="kota" id="kota" class="easyui-combobox" required="true" >
<option value="<?php echo isset($_POST['kota']) ? $_POST['kota'] : ''; ?>"></option>
<?
foreach ($kotaa as $kotaas) {
?>
<option value="<?= $kotaas['IDKabupaten']; ?>"><?= $kotaas['NamaKabupaten']; ?>
</option>
<?php
}
?>
</select>
<script language="javascript" type="text/javascript">
// This is run when the document has loaded.
// Create a combobox
$("#kota").combobox({
selected: function(event, ui) {
$("#kota").val($("#kota").val());
}
});
$("#toggle").click(function() {
$("#kota").toggle();
});
;
</script>
//yang diatas itu supaya combobox jeasyui tetep jalan di view onchange
Tidak ada komentar:
Posting Komentar