I'm fairly new to CI and I'm working on an e-commerce website. I am having problem adding products to the cart.

Below is my code both Jscript and controller. Problem is it's working perfectly fine in localhost but on server it doesn't.

Here is my code:

Ajax Request 

```
    $(document).ready(function(){
            $('.add_cart a').on('click',function(e){
              e.preventDefault();
              var productid = $(this).data('productid');
              var productName = $(this).data('prdname');
              var productPrice  = $(this).data('prdprice');
              var productDp    = $(this).data('prddp');
              console.log(productDp);
              console.log(productid);
              console.log(productPrice);
               console.log(productName);
              $.ajax({
                url:"www.wesbiteurl/home/addToCart/",
                method:'POST',
                data:{id:productid, prdname:productName, 
     prdprice:productPrice, dp:productDp},
                success:function(data){
                  /*alert("product added to cart");*/
                  $('.msg').html(data);
                }
              });
            });
      });

```

This section working fine and I'm sending data from here.

In my controller

```
      public function addToCart(){
            $data = array(
                    'id'=>$this->input->post('id'),
                    'qty' =>1,
                    'price' =>$this->input->post('prdprice'),
                    'name'=>$this->input->post('prdname'),
                    'options' => array('prdDp' => $this->input->post('dp'))
                );

            //return var_dump($data);
            //array(5) { ["id"]=> string(2) "10" ["qty"]=> int(1) ["price"]=> string(2) "20" ["name"]=> string(18) "product name" ["options"]=> array(1) { ["prdDp"]=> string(90) "here link image" } }

                if($this->cart->insert($data)){
                    return var_dump($this->cart->contents());
                }else{
                    return false;
                }
        } 

```

As you can see it's working fine before if statement, after that it's not working. This working fine in the localhost though.