In yii2, I have created two tables sales and sales_items. Sales has only customer id, primary key and defaults. Sales_items has items and details for every sales id. I created a form with CRUD contains
[list=1]
[*]customer_id
[color="#FF0000"][*]product_id
[*]quantity
[*]unit_price[/color]
[/list]
In the list product_id, quantity, unit_price are from sales_item models and customer_id is from sales model.
I placed sales_item model inside a div and clone them with a add item button,Issue is when I clone them for the first time it creates a copy perfectly, but when I click it on the second time the whole page reloads, I have no idea whats going on, need help
my sales.js
clone_count = 0;
$("#add-item").on('click', function(){
clone_count = clone_count+1;
var clone = $(".items:first").clone();//.items is the enclosing div
clone.insertAfter(".items:first");
});
Note: if I don’t enter any values, then it seems to be fine, but if I add any values and cloned the page reloads