我正在使用 codinator 选择 id 显示值其他输入框但不显示任何值。请帮助...
在此处选择选项查看页面代码
工作正常
<select id="tanktype" name="tankno" class="form-control tankno" required >
<option>Select</option>
<?php
$queryw = $this->db->where('vh_rdi',$_SESSION['rdi']);
$queryw = $this->db->get('vh_stock');
if ($queryw->num_rows() > 0)
{
foreach ($queryw->result() as $roww)
{
?>
<option value="<?php echo $roww->vh_id; ?>"><?php echo $roww->vh_id; ?></option>
<?php } } ?>
</select>
结果显示视图字段相同的页面但不显示任何值
<input name="vh_stock" type="text" class="vh_stock" value="">
JavaScript 代码在这里
alert('ajax completed. Response: '+data) 很好,但在 vh_stock 获取值后不显示
<script>
$(document).ready(function(){
$('#tanktype').change(function(){
//Selected value
var id = $(this).val();
alert("value in js "+id);
//Ajax for calling php function
$.post('<?php echo base_url()."index.php/Mechanical_rdirecived/viewtankstock"; ?>', { dropdownValue: id }, function(data){
alert('ajax completed. Response: '+data);//working fine result
//do after submission operation in DOM
$(".vh_stock").val(data.vh_stock); //value is not getting
//$(".id1").val(data.id1);
//}, 'json')
});
});
});
</script>
控制器 => Mechanical_rdirecived/viewtankstock
工作正常
public function viewtankstock()
{
$id = $this->input->post('dropdownValue');
$this->load->model('Model_fuel_rdirecived');
$this->Model_fuel_rdirecived->viewtankstock($id);
}
模型=>Model_fuel_rdirecived->viewtankstock($id);
哆啦的时光机