title: Ajax call not working in CodeIgniter
body: <p>I am trying to test AJAX in CodeIgniter, with no luck so far. Please tell me where I am going wrong.</p>
  
  <p>Here is my <code>test_page.php</code>:</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;!DOCTYPE html&gt;
  &lt;head&gt;
      &lt;script src="&lt;?php echo base_url();?&gt;assets/libs/jquery/jquery-2.2.3.min.js"&gt;&lt;/script&gt;
      &lt;script src="&lt;?php echo base_url();?&gt;assets/libs/jquery/jquery-2.2.3.min.js"&gt;&lt;/script&gt;
      &lt;script src="&lt;?php echo base_url();?&gt;assets/libs/js-cookie/js.cookie.js"&gt;&lt;/script&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;button id="btn" onclick="gethtml()"&gt;ajax Test&lt;/button&gt;
  
  &lt;script type="text/javascript"&gt;
  function gethtml(){
      var url = "&lt;?php echo base_url();?&gt;home/ajax_test";
      alert(""+url);
      $.ajax({
          url: url,
          type: 'POST',
          dataType: 'json',
          success: function(data){
              alert("ajax success");
          }
      });
  }
  &lt;/script&gt;
  
  &lt;/body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here is my function in controller:</p>
  
  <pre><code>public function ajax_test() {
      echo "return from ajax";
  }
  </code></pre>