| Server IP : 103.48.194.25 / Your IP : 216.73.216.231 Web Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.33 System : Linux VMHostDefault 3.10.0-1160.42.2.el7.x86_64 #1 SMP Tue Sep 7 14:49:57 UTC 2021 x86_64 User : sieuthimay ( 1016) PHP Version : 8.2.20 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/khonguyenlieu.vn/public_html/templates/js/ |
Upload File : |
// JavaScript Document
var cart = {
//contacts lense
add : function ()
{
var flag_save =true;
$("#frmproduct").validate({
rules: {
nb_order:{required:true}
},
messages: {
nb_order:"Vui lòng nhập số lượng"
},
submitHandler: function(form)
{
dataString = $("#frmproduct").serialize();
if(flag_save==true)
{
flag_save = false;
$.ajax({
type: "POST",
url: site + "cart/add",
data: dataString,
async:false,
error: function (request, status, error){
flag_save = true;
},
success: function()
{
flag_save = true;
window.location = site + 'gio-hang.html' ;
}
});
}
}
});
},
remove : function(proid, id, items)
{
$('#'+id).css('display',"none");
$.post(site+'ajax/RemoveCart',{'proid':proid, 'item':items}, function(res){
if(res=='success')
{
// tính giá lại
alert("Product have removed.");
window.location.reload();
}else{
alert("There are error happened.");
}
}) ;
},
edit : function ()
{
var flag_save =true;
$("#frmproduct").validate({
rules: {},
messages: {},
submitHandler: function(form)
{
dataString = $("#frmproduct").serialize();
if(flag_save==true)
{
flag_save = false;
$.ajax({
type: "POST",
url: site + "cart/edit",
data: dataString,
//dataType: 'json',
async:false,
error: function (request, status, error){
flag_save = true;
},
success: function()
{
flag_save = true;
window.location = site + 'gio-hang.html' ;
}
});
}
}
});
}
};
viewcart = {
getObj : function (id)
{
var proid = document.getElementById('proid') ;
var numpro = document.getElementById('listnum') ;
proid.value += id + "," ;
numpro.value += 1 + "," ;
},
viewcart : function()
{
window.location = "index.php?/viewcart" ;
},
shopping_submit : function ()
{
var sendcart = document.getElementById("shopping") ;
sendcart.action = "index.php?/sendcart" ;
sendcart.method= "post" ;
sendcart.submit() ;
}
};