I want to send data from JS file to PHP file where a function receives this data and performs further actions on it. But the problem is that the data isn't receiving from JS to controller function.
JS code:
$("#mybtn").click(function(){
  $.post(<?= base_url()?>+"upload",{a1: $('#a1').val(), a2: 
  $('#a2').val(), a3: $('#a3').val(), a4: $('#a4').val(),a5: 
  $('#a5').val()},function(data) {
  });
});     
Controller function:
function upload() {
  echo "this is upload";
  $data = array(
    'name' => $this->input->post('a1'),
    'email' => $this->input->post('a2'),
    'pass' => $this->input->post('a3'),
    'amnt' => $this->input->post('a4'),
    'pcode' => $this->input->post('a5')
  );
  $result = $this->pages_m->upload($data);
  var_dump($data);
}
 
     
    