sessionStorage的使用

<script>
$(document).ready(function(){
  sessionStorage.setItem('order_parm','{json_encode($_GET)}'); 
});
</script>
function setDefault(id){
         $.ajax({
              type: "get",
              dataType: "json",
              url:'/index.php?s=order&c=cart&m=address_setDefault&id='+id,
              
              success: function(data){
                
                if(data.code==1){ 
                   var url = $.parseJSON(sessionStorage.getItem('order_parm'));
                   
                   if(url.oid){
                        setTimeout(function () {
                           window.location.href = "/index.php?s=order&c=home&m=cart_index&oid=" + url.oid+"&address_id="+id
                       }, 10);
                   }else{
                       setTimeout(function () {
                           window.location.href = "/index.php?s="+url.s+"&c="+url.c+"&m="+url.m+"&mid=mall&cid="+url.cid+"&num=1"+"&address_id="+id
                       }, 10);
                   }
                }
              },
              
              error:function(data){
                  alert(data);
                  return false;
              }

            });
    }

 

No comments, so go and ...add one

Speak Your Mind

Your email address will not be published. Required fiels are marked *
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>