Ajaxlink Collect Data From Form

Currently I have the following ajaxLink:




  echo CHtml::ajaxLink(

  'Add', 

  $this->createUrl("/site/addToCart", array("product_id" => $model->id, "quantity" =>1)),

  array(

      "dataType" => 'json',                            

      "success"=>"js:function(data){

        $(\"#basketItems\").html(data.basket);

      }"

  ), 

  array(

    "id"=>"cart-btn-".$model->id,

    "class" => "medium round secondary button",

     "href"=>$this->createUrl("/site/addToCart", array("product_id" => $model->id, "quantity" => 1)),

							"title"=>'Add'

						));?>		



Here you see that I have quantity = 1.

However, I have input on my form:




<input type="text" value="1" name="quantity" id="quantity" />  



And i need to send value of this input (instead of simply "1") to side/addToCart.

Thank you.

try this:




  $this->createUrl("/site/addToCart", array("product_id" => $model->id, "quantity" =>1)),

  array(

      "data" => 'js:$("#my-form-id").serialize()', //add this line

      "dataType" => 'json',                            

      "success"=>"js:function(data){

        $(\"#basketItems\").html(data.basket);

      }



and check out your $_POST in your controller