title: How Can I pass two variable in Ajax URL to codeigniter controller?
body: <p>I am working on a School Management system. I am just creating fetch student details by their class and section. I use ajax + codeigniter controller but I am unable to pass two variable in ajax call to perform 2 parameter search.</p>
  
  <p><strong>My Ajax Code</strong></p>
  
  <pre><code>&lt;script&gt;
                  $(document).ready(function () {
                      $('#example').DataTable({
                          'paging': true,
                          'searching': true,
                          'ordering': true,
                          'autoWidth': false
                      });
                      $('#student').click(function (event) {
                          event.preventDefault();
                          var xclass = $('.sclass').val();
                          var section = $('.section').val();
  
                          //
                          $.ajax({
                              url: "&lt;?php echo base_url(); ?&gt;Admission/fetchStudent/",
                              type: "POST",
                              data: {'xclass': xclass, 'section':section},
                              datatype: 'json',
                              success: function (data) {
                                  $("#resultlist").html(data);
                              }
                          });
                      });
                  }); //event.preventDefault(); 
  
              &lt;/script&gt;
  </code></pre>
  
  <p><strong>My Controller</strong></p>
  
  <pre><code>public function fetchStudent($class,$section){
      $this-&gt;load-&gt;model('Admission_model');
      $data = $this-&gt;Admission_model-&gt;fetchStudentmodel($class,$section);
      echo '&lt;pre&gt;';
      print_r($data);
      exit();
      echo json_encode($data);
  }
  </code></pre>
  
  <p><strong>My Model is</strong></p>
  
  <pre><code>public function fetchStudentmodel($x,$y) {
      $uid = $this-&gt;session-&gt;userdata('user_id');
      $data = $this-&gt;db-&gt;select('*')
              -&gt;from('student')
              -&gt;where(['user_id' =&gt; $uid,'class'=&gt;$x, 'section'=&gt;$y])
              -&gt;get();
  
      if ($data-&gt;num_rows() &gt; 0) {
          return $data-&gt;result();
      } else {
          return 'No data Available';
      }
  }
  </code></pre>
  
  <p>See this image then you can understand what I want to do <img src="https://i.stack.imgur.com/Yn6yB.png" alt="enter image description here"></p>