Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form id="form-product-info" data-parsley-validate class="form-horizontal form-label-left">
- <div class="form-group">
- <label class="control-label col-md-3 col-sm-3 col-xs-12" for="product-SKU">SKU <span class="required">*</span>
- </label>
- <div class="col-md-6 col-sm-6 col-xs-12">
- <input type="text" id="product-SKU" required="required" class="form-control col-md-7 col-xs-12" value="<?php echo $results[0]->SKU; ?>">
- </div>
- </div>
- <div class="ln_solid"></div>
- <div class="form-group">
- <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
- <button class="btn btn-primary" type="button" id="btn-customer-list">Cancel</button>
- <button class="btn btn-danger" type="button" id="btn-delete-product">Delete</button>
- <button type="submit" class="btn btn-success source">Submit</button>
- </div>
- </div>
- </form>
- public function updateProductInformation()
- {
- $product_information['name'] = $this->input->post('name');
- $product_information['SKU'] = $this->input->post('SKU');
- $product_information['product_id'] = $this->input->post('id');
- $product_information['last_updated'] = date('Y-m-d H:i:s');
- var_dump($product_information);
- $update = $this->updateProductInformation($product_information);
- $this->update($update);
- }
- $('#form-product-info').submit(function() {
- alert('Submitting form');
- var id = $('#product-name').data('product-id');
- updateProductInformation(id);
- });
- function updateProductInformation(id)
- {
- alert('Updating product information ' + id);
- var name = $('#product-name').val();
- var SKU = $('#product-SKU').val();
- alert(name);
- alert(SKU);
- alert(id);
- $.ajax({
- type: 'post',
- url: base_url + 'product/updateProductInformation',
- data: {
- 'name' : name,
- 'SKU' : SKU,
- 'id' : id
- },
- success: function(msg)
- {
- if (msg == 'true')
- {
- alert('Updating product information successful');
- }
- else
- {
- alert("Please try again. ");
- }
- },
- error: function(jqXHR, textStatus, errorThrown)
- {
- console.log('Response text: ' + jqXHR.responseText);
- console.log('Status code: ' + textStatus);
- console.log('Error thrown: ' + errorThrown);
- }
- });
- }
- array(4) { ["name"]=> NULL ["SKU"]=> NULL ["product_id"]=> NULL ["last_updated"]=> string(19) "2017-09-23 10:07:20" }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement