如何在CodeIgniter中获取服务器端AJAX查询的参数?
我有AJAX代码,它调用CodeIgniter后端的控制器:如何在CodeIgniter中获取服务器端AJAX查询的参数?,ajax,codeigniter,Ajax,Codeigniter,我有AJAX代码,它调用CodeIgniter后端的控制器: <script> $(document).ready(function(){ $("#select_bank").change(function(){ selected_bank = $("#select_bank option:selected").text(); $.ajax({
<script>
$(document).ready(function(){
$("#select_bank").change(function(){
selected_bank = $("#select_bank option:selected").text();
$.ajax({
url:'<?=base_url().'atm/select_region/&'+selected_bank; ?>',
success:function(msg){
}
});
});
});
不起作用。真的,我想澄清一下,现在您需要告诉ajax函数您正在发送POST数据
$.ajax({
type: "POST",
dataType: 'html',
url: <?= base_url ?> + "atm/select_region",
data: {nameofpostvariable:valuethatyousend},
success: function(output){
},
error: function(output){
alert('error');
}
});
$.ajax({
类型:“POST”,
数据类型:“html”,
url:+“atm/选择区域”,
数据:{nameofpostvariable:valuethatyousend},
成功:功能(输出){
},
错误:函数(输出){
警报(“错误”);
}
});
在data:{nameofpostvariable:valuethatyousend}行上,
您正在创建一个$\u POST['nameofpostvariable']
$.ajax({
type: "POST",
dataType: 'html',
url: <?= base_url ?> + "atm/select_region",
data: {nameofpostvariable:valuethatyousend},
success: function(output){
},
error: function(output){
alert('error');
}
});