我在CodeIgniter中创建了Jquery Ajax来调用相同的值。 下面的代码。 index.php =查看
<!-- JK Start -->
<div id="hide-table">
<form action="" method="">
<select id="fee_group">
<?php
$fee_group = $this->db->get("feegroup"); #fetching all the values from feegroup table to get related fee structure
$details = $fee_group->result();
foreach ($details as $d) {
echo "<option value='".$d->feegroupID."'>".$d->name."</option>";
}
?>
</select>
</form>
<div id="record">
</div>
</div>
<!-- JK Over -->
</div><!-- ./wrapper -->
<script type="text/javascript">
$(document).ready(function(){
$("#fee_group").on("change",function(){
var view_permissions = $("#fee_group").val();
alert(view_permissions);
$.ajax({
type:"post",
url:"http://sample.in/school/feemonths/record",
data:"view_permissions="+view_permissions,
success:function(msg){
$("#record").html(msg);
}
});
});
});
</script>
fee_m.php =控制器
public function record()
{
echo "this is sample data";
}
当我点击或选择一个值时,没有任何回报。我直接打电话时看到的网址是正确的。