• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post method not working in Codeigniter

#1
[eluser]vikas.fourorange[/eluser]
This is my first question on CI forms.Which obviously shows that I am a noob in codeigniter.Please help.

I am using HMVC codeigniter. I am trying to use jquery ajax first time. When i use POST then it gives undefined error while it response me the data while using GET.

Code:
$.ajax({
     type: "POST",
     url: filelink+"cart/add_cart_item",
     data: {"product_id":id,"quantity":qty,"ajax":"1"},
     dataType: "json",
            success: function(msg){
      alert( "Data Saved: " + msg );
        },
             error: function(jqXHR, textStatus, errorThrown){
      alert(textStatus + " " + errorThrown);
       }
      });
What I have tried so far after googling

a) my file url location is accessible directly. I checked it. giving response.

b) Firebug is giving 500 internal server error for the same file.

c) Using Get is responding me back well

d) added json in the datatype

controller

Code:
class Cart extends CI_Controller { // Our Cart class extends the Controller class
      
      function __construct()
      {
  parent::__construct();
  $this->template->set('controller', $this);
      }

   function _remap()
     {
     $uri2 = $this->uri->segment(2);
     if (is_numeric($uri2) OR $uri2 == FALSE) {
   $this->index();
       } else if ($uri2 == 'add_cart_item') {
   $this->add_cart_item();
     } else if ($uri2 == 'show_cart') {
   $this->show_cart();
     }
      }

function add_cart_item(){
       echo "asdfsadfdsf";
       exit;
     }
      }

can anybody please help me out?



Messages In This Thread
Post method not working in Codeigniter - by El Forum - 06-28-2012, 05:50 AM
Post method not working in Codeigniter - by El Forum - 06-28-2012, 07:32 AM
Post method not working in Codeigniter - by El Forum - 06-28-2012, 10:26 AM
Post method not working in Codeigniter - by El Forum - 06-28-2012, 10:41 AM
Post method not working in Codeigniter - by El Forum - 06-28-2012, 10:51 AM
Post method not working in Codeigniter - by El Forum - 06-28-2012, 01:26 PM
Post method not working in Codeigniter - by El Forum - 06-28-2012, 10:03 PM
Post method not working in Codeigniter - by El Forum - 06-28-2012, 10:53 PM
Post method not working in Codeigniter - by El Forum - 06-28-2012, 11:00 PM
Post method not working in Codeigniter - by El Forum - 07-05-2012, 12:10 AM
Post method not working in Codeigniter - by El Forum - 07-05-2012, 02:21 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.