我遇到AJAX返回值的问题。返回的数据未显示在我页面的源代码中。
这是我在Codeigniter中的控制器代码:
public function get_rooms(){
$rooms_selected = $this->input->get('q', TRUE);
$this->load->model('roomreservation_model');
$room_numbers = $this->roomreservation_model->numberofroom($rooms_selected);
echo '<select class="form-control" name="room_number" id="room_number">';
foreach ($room_numbers as $value) {
echo '<option value="'.$value->room_number.'">'.$value->room_number.'</option>';
}
echo '</select>';
}
HTML代码
<div class="col-lg-12">
<h2 class="sub-header">Room Detail</h2>
<div class="col-lg-6 col-xs-12 form-label">
<label for="Room Type">Room Type</label>
<select class="form-control" name="roomtype" id="roomtype" onchange="showUser(this.value)">
<option value="">Select a Room Type</option>
<option value="King Suit">King Suit</option>
<option value="Suit One">Suit One</option>
<option value="Suit Two">Suit Two</option>
<option value="Suit Three">Suit Three</option>
</select>
</div>
<div class="col-lg-6 col-xs-12 form-label">
<label for="Room Type">Room Avaiable</label>
<div id="txtHint">
<b style="color:#6E6E6E">Select Room type then show Avaiable Rooms</b>
</div>
</div>
</div>
当我选择一个房间类型(从我的选择下拉列表中)时,会发出一个AJAX请求,该请求返回所有可用房间。它的工作原理,但问题是我检查浏览器的源代码。它不显示可用房间的来源。