cancel
Showing results for 
Search instead for 
Did you mean: 

Ajax call without clearing local storage data

Ajax call without clearing local storage data

I have added a code to shipping-service.js:

     updateCustomOptionStatusbyPostcode:function(postcode=""){

            console.log('updateCustomOptionStatusbyPostcode='+postcode);
            if(postcode==undefined){postcode="";}
            if(postcode==""){
                $('.product-custom-option').prop('checked', false); 
            }
            if(postcode ==null){postcode = "";}
           if(postcode!=""){
                  $.ajax({
                               type: "POST",
                               url: "updatePost",
                               data: "update_cart_action=update_session_postcode&postcode="+postcode,
                               success: function (data) {
                                console.log(data);
                               $('.cart-container form#form-validate').replaceWith(data.cartcontent);
                           
                                             
                               },
                               failure: function (errMsg) {
                                   console.log(errMsg);
                   
                               }
                       });
                    }      


        }

Which works, however after ajax call -> reloading page it clears checkout-data.

Do you have any suggestions to how to keep the data.

 

Is it possible to make an Ajax call without clearing local storage data?