title: Jquery Ajax Post Error Undefined in Codeigniter
body: <p>I am implementing a jquery ajax form submission on selecting the checkbox. I am always getting error undefined in the response data. Please find my code as following.</p>
  
  <p><strong>Jquery Post</strong></p>
  
  <pre><code>  $.ajax({
     type: "POST",
     url: filelink+"playlist/add_cart_item",
     data: {"product_id":id,"quantity":qty,"ajax":1},
     success: function(msg){
     alert( "Data Saved: " + msg );
     },
     error: function(jqXHR, textStatus, errorThrown) 
     { 
      alert(textStatus + " " + errorThrown) 
     }
    });
  </code></pre>
  
  <p><strong>Controller Function</strong></p>
  
  <pre><code>   function add_cart_item(){
       echo "true";
     }
  </code></pre>
  
  <p>File link is giving me the exact path. Jquery library file is also properly included. Can anybody please help where could be the problem.</p>
  
  <p><strong>I am using HMVC Codeigniter. Is there any other way of calling php file from ajax in it ??</strong></p>
  
  <p>Also When I am changing the type from POST to GET it is returning my ECHO "TEST" ..
  Thanks</p>