title: Codeigniter JQuery ajax post null value
body: <p>I'm using jquery ajax to send data to controller but it returns null.</p>
  
  <p>I just want to send single input text to controller using ajax.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script&gt;
    $(document).ready(function() {
      $("#sendOtp").click(function(e){
        console.log("working");
        e.preventDefault();
        //var mobileno = $("#mobileno").val();
        $.ajax({
          type:"POST",
          url:"&lt;?php echo base_url()?&gt;"+"index.php/welcome/generateOtp",
          data:  {mobileno: $("#mobileno").val()},
          dataType: "json",
          cache:false,
          success:function(response){
            console.log(response);
          },
          error: function ($data) {
            console.log(data);
          }
        });
      });
    });
  &lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <pre><code>public function generateOtp(){
  
      $mobile = $this-&gt;input-&gt;post('mobileno');
  
  
      echo $mobile;
  
  }
  </code></pre>
  
  <p>This is my html from where i have to send data</p>
  
  <pre><code>  &lt;div class="form-group"&gt;
                  &lt;div class="col-sm-12"&gt;
                    &lt;input type="text" class="form-control" name="mobileNo" id="mobileNo" placeholder="mobile"&gt;
          &lt;br&gt;
          &lt;button class="btn" id="sendOtp"&gt;Send OTP&lt;/button&gt;
                  &lt;/div&gt;
                &lt;/div&gt;
  </code></pre>