 |
|
จาก Script นี้ ผมอยากดึงค่าตัวแปร item.year ไปใส่ใน Textbox
ต้องวาง Code $('#eq_no_year').val(item.year)ไว้ตรงไหนครับ
พอดี ลองวางหลายทีแล้ว Error ขอบคุณครับ
Code (JavaScript)
<script type="text/javascript">
$("#eq_no").select2({
placeholder: 'เลือกข้อมูล',
ajax: {
url: '/select2_eqno',
dataType: 'json',
delay: 250,
processResults: function (data) {
return {
results: $.map(data, function (item) {
return {
text: item.listName ,
id: item.eq_no,
}
})
};
},
cache: true
}
});
</script>
Tag : PHP, HTML, JavaScript, Ajax, jQuery
|
ประวัติการแก้ไข 2018-07-12 10:08:47
|
 |
 |
 |
 |
Date :
2018-07-12 10:08:02 |
By :
the_cop |
View :
794 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |