function loadSelectBox(id,url,selected){
$.get(
url,{},function(data){
$(id).html(data);
if (selected!=''){
$(id+' option[value='+selected+']').attr('selected','selected');
}
$("#loading_img").hide();
}
);
}
//ดึง Staff มาแสดง
$("#roleid_").on('change', function() {
if($("#roleid_").val()!= ""){
$("#loading_img").show();
var userid = '';
loadSelectBox(
'#userid',
'index.php?module=AppDashboard&action=getStaffPopup&roleid_='+$("#roleid_").val(),
userid
);
}
});
var userid = '';
loadSelectBox(
'#userid',
'index.php?module=AppDashboard&action=getStaffPopup&roleid_='+$("#roleid_").val(),
userid
);
Tuesday, August 18, 2015
ตัวอย่าง jQuery loadSelectBox
Labels:
JavaScript,
jQuery,
PHP
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment