Codeigniter,如何使用javascript在控制器中获得2个参数?

hey guys i got a shopping cart that loads using jquery, now im using codeigniter, and i dont know how to get two of the params i use by get. This's the javascritp method that calls the script.

  function anade() {
      var idnumero = $(this).val();
      var quant = $("#num" + idnumero).val();
      $("#carrito").load("http://example.com/cart/addToCart?p=" + $(this).val() + "&cant=" + quant);
  }

this is my old script, now im implementing mvc with codeigniter, so i wont to re write this:

session_start();
$suma=0;
if (isset($_GET['p'])) {
    $_SESSION['product'][$_SESSION['count']] = $_GET['p'];
    $_SESSION['quantity'][$_SESSION['count']] = $_GET['quant'];
    $_SESSION['count']++;
}

$conexion = mysqli_connect($bd_servidor, $bd_usuario, $bd_contrasenia, $bd_basededatos);
mysqli_set_charset($conexion, "utf-8");

echo"<table>";
for ($i = 0; $i < $_SESSION['count']; $i++) {
    //echo "Product:  " . $_SESSION['product'][$i] . "<br />";
    $query = "SELECT * FROM producto WHERE idproducto=" . $_SESSION['producto'][$i] . "";
    $resultado = mysqli_query($conexion, $query);
    while ($fila = mysqli_fetch_array($resultado)) {
        echo "<tr><td>Unid : ".$_SESSION['quantity'][$i]."</td><td>" . $fila['name'] . "</td><td> " . number_format(($_SESSION['quantity'][$i]*$fila['price']),2) . "</td></tr>";
        $suma+= $_SESSION['quantity'][$i]*$fila['price'] ;
    }
}
//echo"<hr>";
echo "<tr><td>Subtotal</td><td></td><td>".  number_format($suma,2)."</td></tr>";
echo "</table>";

i would like to know how should i do the controller. something like this is OK? function getCart($p, $cant){ method...}

Thxs!

Here is the code you should use for 2 parameters to get in CodeIgniter.

Java Script

function anade() {
      var idnumero = $(this).val();
      var quant = $("#num" + idnumero).val();
      $("#carrito").load("http://example.com/cart/addToCart/" + $(this).val() + "/" + quant);
  }

In CodeIgniter

function getCart($p, $cant)
{
}