【发布时间】:2014-07-07 10:32:20
【问题描述】:
我需要在某些事件中插入用户的最后一个插入 ID ..... 我想在另一页上得到它.... 喜欢在产品页面上......用户自定义他的产品......喜欢mug customization
我需要将插入的....自定义产品ID添加到购物车页面,这是由ajax完成的....那么我如何从产品页面获取购物车页面上的最后一个插入ID....
我的 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...');
}
});
});
我的 ci 函数
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);
}
}
}
【问题讨论】:
标签: php jquery mysql ajax codeigniter