title: jQuery and CodeIgniter AJAX with JSON not working
body: <p>I trying to make my first AJAX with JSON call using jQuery and CodeIgniter.
  But for some weird reason it's not working.</p>
  
  <p>The jQuery code:</p>
  
  <pre><code>var item = "COOL!";
  $.post("http://192.168.8.138/index.php/main/test", { "item" : item },
           function(data){
              alert(data.result);
           }, "json");
  </code></pre>
  
  <p>The CodeIgniter code:</p>
  
  <pre><code>&lt;?php
  class main extends Controller {
     function test() {
        $item = trim($this-&gt;input-&gt;post('item'));
        $array = array('result' =&gt; $item);
        echo json_encode($array);
     }
  }
  ?&gt;
  </code></pre>
  
  <p>I tried to access the <code>http://192.168.8.138/index.php/main/test</code> page manually and it seems to be working, I got: <code>{"result":""}</code></p>
  
  <p>I also tried to use Firebug to see <code>XMLHttpRequest</code> but saw nothing.</p>
  
  <p>I have no idea what am I doing wrong... Need help really badly.
  Thank you.</p>