I have the AJAX-code, which calls to controller of CodeIgniter’s back-end:
<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){
}
});
});
});
So, I want to get this params in the controller (CodeIgniter), but, because of this is not at the any form, using the
$bank = $this->input->post('')
gives no effect. really, I’d like to clarify this moment
You need to tell the ajax function that you’re sending POST data
On the line
data: {nameofpostvariable:valuethatyousend},you are creating a $_POST[‘nameofpostvariable’]