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....
$('#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);
}
}
}
public function saveData()
{
if ($this->input->post('action') == 'store')
{
$views = $this->input->post('views');
$id = $this->product_model->save($views);
$data = array('userid'=>$id); //insert id to userid as session variable
$this->session->set_userdata($data); //set userid as a session variable
if ($id != '')
{
header('Content-Type: application/json');
echo json_encode($id);
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.