Hello. I have a form for online store sending the product to the basket.
<form id="myform"> <input type="button" value="+" onclick="addProduct(<?=$result->id?>)"> <input type="text" size="4" value=0 name="javob" id='<?=$result->id ?>'> <input type="button" value="-" onclick="removeProduct(<?=$result->id?>)"> here the number of products is selected and sent to the basket. And I need when the user selects this product and sends it to the basket, enrolled in the database. I found some example but I did not succeed. Please help newcomer. Here is my example.
$("#myform").submit(function(){ $.ajax({ url: '/main/Create', type: "POST", data: { count: $_POST["javob"].val(); product_id: $result->product_id.val(); user_id: Yii::app->user->id.val(); price: $result->price.val(); status: 0; date: Data(); }, success: function(data){ console.log(data); } }); });
actionCreate()code of the controllermain- Blacknife