var rootHeader = 'http://akasugu.fcart.jp'; var count = 0; function authlinkLoad() { if (rootHeader != '') { var elementAuth = document.getElementById('jsauthlinkframe'); if (elementAuth != null) { jQuery.ajax( { url:rootHeader + '/jscart/header_authlinkAjax.aspx', type:'get', data:'', async:false, success:function(data, textStatus, httpObj){ var res = httpObj.responseXML; var auth = res.getElementsByTagName('jsauthlink')[0]; if (auth != null) { elementAuth.innerHTML = auth.firstChild.nodeValue; } }, error:function(){ elementAuth.innerHTML = ''; } } ); } } } function mypagenaviLoad() { if (rootHeader != '') { var elementMypage = document.getElementById('jsmypageframe'); if (elementMypage != null) { jQuery.ajax( { url:rootHeader + '/jscart/header_mypagenaviAjax.aspx', type:'get', data:'', async:false, success:function(data, textStatus, httpObj){ var res = httpObj.responseXML; var myp = res.getElementsByTagName('jsmypage')[0]; if (myp != null) { elementMypage.innerHTML = myp.firstChild.nodeValue; } }, error:function(){ elementMypage.innerHTML = ''; } } ); } } } function cartReload() { if (rootHeader != '') { var elementCart = document.getElementById('jscartframe'); if (elementCart != null) { jQuery.ajax( { url:rootHeader + '/jscart/cartAjax.aspx', type:'get', data:'', async:false, success:function(data, textStatus, httpObj){ var res = httpObj.responseXML; var cart = res.getElementsByTagName('jscart')[0]; if (cart != null) { elementCart.innerHTML = cart.firstChild.nodeValue; } }, error:function(){ elementCart.innerHTML = ''; } } ); } } } function cartUpd(cart, goods, qty) { if (rootHeader != '') { jQuery.ajax( { url:rootHeader + '/jscart/cartupd.aspx', type:'post', data:'cart=' + cart + '&goods=' + goods + '&qty=' + qty, async:false, success:function(){ //document.getElementById('cartMsg_' + cart).innerHTML = '数量変更' }, error:function(){ //document.getElementById('cartMsg_' + cart).innerHTML = '申し訳ありませんが、しばらくしてから再度お試しください。' } } ); } } function cartDel(cart, goods) { if (rootHeader != '') { jQuery.ajax( { url:rootHeader + '/jscart/cartdel.aspx', type:'post', data:'cart=' + cart + '&goods=' + goods, async:false, success:function(){ //document.getElementById('cartMsg_' + cart).innerHTML = '削除' }, error:function(){ //document.getElementById('cartMsg_' + cart).innerHTML = '申し訳ありませんが、しばらくしてから再度お試しください。' } } ); } } function changeQty(cart, goods, qty) { if (count != 0) { return; } count = 3; var callback = function() { if (count == 3){ count--; timer = setTimeout(callback, 100); } else if(count == 2) { cartUpd(cart, goods, qty); count--; timer = setTimeout(callback, 100); } else if(count == 1) { cartReload(); count--; timer = setTimeout(callback, 100); } else { // } } timer = setTimeout(callback, 0); return; } function deleteCart(cart, goods) { if (count != 0) { return; } count = 3; var callback = function() { if (count == 3){ count--; timer = setTimeout(callback, 100); } else if(count == 2) { cartDel(cart, goods); count--; timer = setTimeout(callback, 100); } else if(count == 1) { cartReload(); count--; timer = setTimeout(callback, 100); } else { // } } timer = setTimeout(callback, 0); return; }