I need to insert last insert id of user on some event ..... And I want to get that on another page.... Like On product page ....user customizing his product....like mug customization
And i need to get the inserted....customization product id to the cart page and this is done by ajax....so how can i get last insert id on cart page from product page....
my ajax...
$('#store').click(function () {
$.ajax({
type: "POST",
url: ajax_url_store,
data: {
action: 'store',
views: JSON.stringify(thsirtDesigner.getProduct())
},
success: function (data) {
if (parseInt(data) > 0) {
//successfully added
document.getElementById('succes-message').innerHTML = 'You Design has Been SuccessFully Saved';
} else {
}
},
error: function () {
//alert('some error has occured...');
},
start: function () {
//alert('ajax has been started...');
}
});
});
My ci function
public function saveData() {
if ($this - > input - > post('action') == 'store') {
$views = $this - > input - > post('views');
$id = $this - > product_model - > save($views);
if ($id != '') {
header('Content-Type: application/json');
echo json_encode($id);
}
}
}