title: Ajax not working in codeigniter 3
body: <p>when i click in the button <code>btnSalvar</code>, ajax need to send data to my <code>controller</code>, but not working.</p>
  
  <p>my <code>ajax</code>:</p>
  
  <pre><code>$("#btnSalvar").on('click', function(){
  
                      $.ajax({
                              url: '&lt;?= base_url(); ?&gt;' + 'grupoProduto/cadastro',
                              type: 'POST',
                              data: {Nome: $("#txtNome").val(), Ativo: $("#cbxAtivo").val()},
                              dataType: 'json',
                              cache: false,
                              success: 
                                        function(data){
                                          alert(data.Nome);  //as a debugging message.
                                        }
                          });
                      return false;
  
      });
  </code></pre>
  
  <p>My controller:</p>
  
  <p><code>public function cadastro() {
          $this-&gt;load-&gt;view('grupoproduto_view');
      }</code></p>
  
  <p>my <code>alert(data.Nome)</code> showing nothing</p>
  
  <p>here's my full php code:</p>
  
  <p>`
      </p>
  
  <pre><code>    &lt;div class="row"&gt;
          &lt;div class="form-group"&gt;
              &lt;label for="txtNome" class="col-md-3 control-label"&gt;Nome&lt;/label&gt;
              &lt;div class="col-md-6"&gt;
                  &lt;?php echo form_input(['name' =&gt; 'txtNome', 'class' =&gt; 'form-control', 
                  'value' =&gt; set_value('txtNome'), 'required' =&gt; 'true', 'maxlength' =&gt; '50', 'required' =&gt; 'true', 'id' =&gt; 'txtNome']); ?&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
              &lt;label for="cbxAtivo" class="col-md-3 control-label"&gt;Ativo&lt;/label&gt;
              &lt;div class="col-md-1"&gt;
                  &lt;?php echo form_checkbox(['name' =&gt; 'cbxAtivo', 'class' =&gt; 'form-control', 'required' =&gt; 'true', 'id' =&gt; 'cbxAtivo']); ?&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div class="row"&gt;
          &lt;div class="col-md-12"&gt;
              &lt;div class="form-group"&gt;
                  &lt;div class="modal-footer"&gt;
                      &lt;?php echo anchor(NULL, "&lt;i class='glyphicon glyphicon-remove'&gt;&lt;/i&gt; Sair", ['class' =&gt; 'btn btn-default', 'id' =&gt; 'btnSair', 'role' =&gt; 'button', 'data-dismiss' =&gt; 'modal']); ?&gt;
  
                      &lt;?php echo form_button(NULL, "&lt;i class='glyphicon glyphicon-ok'&gt;&lt;/i&gt; Salvar", ['class' =&gt; 'btn btn-success', 'id' =&gt; 'btnSalvar', 'role' =&gt; 'button']); ?&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
  &lt;/fieldset&gt;
  </code></pre>
  
  <p></p>
  
   
  
  <p>new edit!</p>
  
  <pre><code>      `$("#btnSalvar").on('click', function(){
  
          var nome = $("#txtNome").val();
          var ativo = $("#cbxAtivo").val();
  
          var url = '&lt;?= base_url(); ?&gt;grupoProduto/cadastro';
  
          $.ajax({
                  url: url,
                  type: 'POST',
                  data: {Nome: nome, Ativo: ativo},
                  dataType: 'json',
                  cache: false,
                  success: 
                            function(data){
                              alert(data.Nome);  //as a debugging message.
                            },
                  error: function() { 
                      alert(url);
                  }     
              });
          return false;
  
      });`
  </code></pre>
  
  <p>return <code>error</code> in the ajax and show this url: <code>http://localhost/admin/grupoProduto/cadastro</code>. It's correct, but why not success? </p>