我正在使用帶有javascript和ajax的協調員php框架。逗號分隔的值不顯示,但單個值工作正常。我有表字段,如(edit_coach = 9,10,11),(edit_depot = 5,Spur,SPJ)和edit_task_type = 5請分享有價值的想法...數據庫edit_coach = 9,10,11 //not show data edit_depot = 5,Spur,SPJ //not show data edit_task_type = 5 //working fine JavaScript Code here function edit_assign_train(val) { $.ajax({ url: "<?php echo base_url(); ?>edit_assign_train", type: "post", data: "atrain_id="+val, success: function (response) { var res = JSON.parse(response); console.log(res); $('#edit_train_no').val(res[0]['train_no']); $('#edit_depot').val(res[0]['depot_id']+'-'+res[0]['depot_code']+'-'+res[0]['depot_name']).trigger('change');// not working $('#edit_coach').val(res[0]['coach']).trigger('change');// not working $('#edit_task_type').val(res[0]['task_type']).trigger('change');//working fine $('#edit_tot_coach').val(res[0]['tot_coach']); $('#edit_janitor').val(res[0]['janitor']); $('#edit_time').val(res[0]['time_val']); $('#edit_id').val(res[0]['id']); } });此處的 HTML 代碼<div class="row"> <label class="col-sm-4 col-form-label text-right">Depot : </label> <div class="col-sm-8"> <div class="form-group">
- 1 回答
- 0 關注
- 105 瀏覽
添加回答
舉報
0/150
提交
取消