|
 |
|
อยากทราบวิธีการดึงข้อมูลมาแสดง ใน intput ที่เป็น combodate หน่อย ครับ |
|
 |
|
|
 |
 |
|
คือผมดึงข้อมูลออกมาได้ทุกอย่างแล้ว เหลือ input ที่เป็น combodate ไม่มา ครับ อยากทราบ ว่า ต้อง ทำยังไง ครับ
Code (JavaScript)
var global_ssopersoncitizenid_content = '<?php echo json_encode($ssopersoncitizenid_list); ?>';
global_ssopersoncitizenid_content = JSON.parse(global_ssopersoncitizenid_content);
//var date = $('input[name="ssopersonbirthdate"]').val(obj['ssopersonbirthdate']);
$(document).ready(function(){
function checkid(id){
var idcheck = false;
$.ajax({
type:"GET",
url:"verify_nation/"+id,
data:"",
contentType:"json",
success:function(data){
if((data =='เลขบัตรนี้ถูกใช้แล้ว')){
alert('เลขบัตรนี้ถูกใช้แล้ว');
chk = $('input[name="ssopersoncitizenid"]').val();
for (var index in global_ssopersoncitizenid_content) {
var obj = global_ssopersoncitizenid_content[index];
if(obj['ssopersoncitizenid'] == chk){
//alert(' >> '+obj['businesscategory']+' >> '+obj['departmentnumber']);
//obj = new String ( ssobranchcode_list );
// document.getElementById('ssopersongender').value = obj['ssopersongender'];
// $('input[name="ssopersonbirthdate"]').val(obj['ssopersonbirthdate']);
//$('input[name="ssopersongender"]').val(obj['ssopersongender']);
$('input[name="ssofirstname"]').val(obj['ssofirstname']);
$('input[name="ssosurname"]').val(obj['ssosurname']);
$('input[name="displayName"]').val(obj['displayName']);
var jak = $('input[name="ssopersongender"]').val(obj['ssopersongender']);
if(jak.val() == 'หญิง'){
alert('female');
$('#famale').prop('checked',true)
// $('input[name="ssopersongender"]').prop("check","check");
}else if(jak.val() == 'ชาย'){
alert('male');
$('#male').prop('checked',true)
//$('input[name="ssopersongender"]').attr("checked");
}
var G = $('input[name="ssopersonbirthdate"]').val(obj['ssopersonbirthdate']); // ถ้าเป็น Textbox ข้อมูลมา แต่เป็น Combodate ข้อมูลไม่มา
$('select[name="initials"]').val(obj['initials']);
$('select[name="title"]').val(obj['title']);
$('input[name="givenName"]').val(obj['givenName']);
$('input[name="sn"]').val(obj['sn']);
$('input[name="cn"]').val(obj['cn']);
$('input[name="uid"]').val(obj['uid']);
$('input[name="mail"]').val(obj['mail']);
$('input[name="maildrop"]').val(obj['maildrop']);
$('select[name="ssobranchcode_listt"]').val(obj['ssobranchcode']);
$('input[name="businesscategory_list"]').val(obj['businesscategory']);
$('input[name="departmentnumber_list"]').val(obj['departmentnumber']);
$('input[name="departmentdescription_list"]').val(obj['departmentdescription']);
$('input[name="workingdeptno_list"]').val(obj['workingdeptno']);
$('input[name="workingdeptdescription_list"]').val(obj['workingdeptdescription']);
$('input[name="workingdeptno_list2"]').val(obj['upperworkingdeptno']);
$('input[name="workingdeptdescription_list2"]').val(obj['upperdepartmentdescription']);
$('select[name="departmentnumber_list2"]').val(obj['departmentnumber2']);
$('input[name="departmentnumber_list3"]').val(obj['upperdepartmentnumber']);
$('input[name="ssopersonposition"]').val(obj['ssopersonposition']);
$('input[name="ssopersonfieldposition"]').val(obj['ssopersonfieldposition']);
$('input[name="ssopersonclass"]').val(obj['ssopersonclass']);
$('input[name="employeetype"]').val(obj['employeetype']);
$('input[name="ssopersonexecposition"]').val(obj['ssopersonexecposition']);
$('input[name="ssopersonempdate"]').val(obj['ssopersonempdate']);
$('input[name="ssopersonempstartdate"]').val(obj['ssopersonempstartdate']);
$('input[name="ssopersonlevel"]').val(obj['ssopersonlevel']);
$('input[name="ssopersonbankaccount"]').val(obj['ssopersonbankaccount']);
$('input[name="employeenumber"]').val(obj['employeenumber']);
$('select[name="accountactive"]').val(obj['accountactive']);
$('.editor').show();
// $('.drop').hide();
break;
}else{
}
//obj = document.getElementById('businesscategory_list')
};
// chk = $('input[name="ssopersoncitizenid"]').val('');
}else{
alert('คุณสามารถใช้งานเลขบัตรนี้ได้');
}
$('label#Show2').html(data);
},
error:function(err){
console.log('Unable to load data from youtube.com')
},
complete:function(){
}
})//end ajax function
return idcheck;
}
$('input[name="btchk"]').on("click",function(){
var chk = $('input[name="ssopersoncitizenid"]').val();
if(chk.length != 13){
alert('รหัสประชาชนไม่ถูกต้อง');
chk = $('input[name="ssopersoncitizenid"]').val('');
return false;
}else{
checkid(chk);
}
// {if(!checknum(document.nation_verity.ssopersoncitizenid.value))
// alert('รหัสประชาชนไม่ถูกต้อง');
// else alert('รหัสประชาชนถูกต้อง เชิญผ่านได้');}
//checkid(chk);
})
})
Tag : Ajax

|
|
 |
 |
 |
 |
Date :
2014-08-28 12:19:41 |
By :
mansanal |
View :
880 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไม่มา คืออะไรไม่มาอย่างไรครับ? ไม่มาตั้งกะตอนที่ response กลับมา หรือว่ามาแล้ว format ไม่ถูก ลอง capture มาดูครับ 
|
 |
 |
 |
 |
Date :
2014-08-29 17:22:42 |
By :
Manussawin |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ข้อมูลมาหมดครับ ถ้าเปน textbox ธรรมดาทั่วไป มันแสดง ตามที่ดึงมาจาก database แต่ ถ้าเป็น combodate มันไม่แสดง ตามช่องอ่า ครับ


|
 |
 |
 |
 |
Date :
2014-09-11 16:08:15 |
By :
mansanal |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|