php - View does not load after form submission through jQuery -
i have following form:
html:
<form name="newproductform" id="newproductform" action="http://localhost/tddd27/index.php/addproduct/addtodatabase"> <br><label>product name:</label> <input name="itemname" type="text"/></br> <br><label>category:</label> <input name="itemcategory" type="text"/></br> <br><label>description:</label> <input name="itemdesc" type="text"/></br> <br><label>price:</label> <input name="price" type="text"/></br> <input type="text" name="id" value="<?php echo $id; ?>" hidden="true" > <input type="text" name="name" value="<?php echo $name; ?>" hidden="true"> <input type="button" id="_newproduct" name="_newproduct" value="submit"> </form>
when user click button jquery submit form.
jquery:
$("#_newproduct").click(function(){ $("#newproductform").submit(); });
the form calls codeigniter controller calls module, , inserts product in database. want after view loaded. wrote:
function addtodatabase() { $itemname=$_get['itemname']; $itemcategory=$_get['itemcategory']; $itemdesc=$_get['itemdesc']; $id=$_get['id']; $price=$_get['itemdesc']; $this->load->model('addproductmodule'); $this->addproductmodule->addproductontable($itemname,$itemcategory,$itemdesc,$id,$price); $data=array('id' => $_get['id'], 'name' => $_get['name']); $this->load->view ( 'adminview',$data); exit; }
the problem load->view
not seem load view. after submission goes , product in database, empty page loaded instead of adminview
. idea problem?
you not want exit after controller method runs...codeigniter still has things after that.
Comments
Post a Comment