[eluser]shades[/eluser]
Code:
[removed]
$(function(){
$('#brand_id').change(function(e){
$.get('get_cat/'+$(this).val(), function(data) {
var new_cat_list = ""
for (var i=0; i<data.categoryList.length; i++)
{
new_cat_list += '<option value="'+data.categoryList[i].id+'">'+data.categoryList[i].name+'</option>';
}
$('#category_id').html(new_cat_list);
}, 'json');
});
});
[removed]
<div id="content" class="xfluid">
<div class="portlet x7">
<div class="portlet-header"><h4>Add Category</h4></div>
<div class="portlet-content">
<?php echo form_open('product/add', array('class'=>'form label-inline'));?>
<div class="field">
<label for="fname">Product Name</label>
<input id="name" name="name" size="50" type="text" class="medium" /></div>
<div class="field">
<label for="lname">SKU / Code No</label>
<input id="sku" name="sku" size="50" type="text" class="medium" /></div>
<div class="field"><label for="lname">Color </label>
<input id="color" name="color" size="50" type="text" class="medium" /></div>
<div class="field">
<label for="type">Brand </label>
<select name="brand_id" id="brand_id" class="medium">
<optgroup label="Brand Avilable">
<option value="null" selected="selected">Choose Category</option>
<?php foreach($brandList->result() as $row): ?>
<option value="<?=$row->id;?>"><?=$row->name;?></option>
<?php endforeach; ?>
</optgroup>
</select>
</div>
<div class="field">
<label for="type">Category </label>
<select name="category_id" id="category_id" class="medium">
<optgroup label="Category Avilable">
<option value="null" selected="selected">Choose Category</option>
<?php foreach($categoryList->result() as $row): ?>
<option value="<?=$row->id;?>"><?=$row->name;?></option>
<?php endforeach; ?>
</optgroup>
</select>
</div>
<div class="field"><label for="lname">Size </label> <input id="size" name="size" size="50" type="text" class="medium" /></div>
<div class="field"><label for="lname">Qty </label> <input id="qty" name="qty" size="50" type="text" class="medium" /></div>
<div class="field"><label for="lname">Unit Price </label> <input id="price" name="price" size="50" type="text" class="medium" /></div>
<br />
<div class="buttonrow">
<button class="btn" type="submit">Add Product</button>
</div>
</form>
</div>
</div>
</div>
above is the view which i have made from ur code but i didnt understand that how it passes to the controller for second brand id to populate furthre