javascript - Refresh page when script is triggered -
i use url remove products outside cart. use following html:
<button type="button" class="btn btn-link btn-xs btn-remove-from-cart" onclick="removeitem('p','{$num}')"><i class="fa fa-times"></i></button>
when clicking on button, following script triggered:
<script> {literal} function removeitem(type,num) { var response = confirm("{/literal}{$lang.cartremoveitemconfirm}{literal}"); if (response) { window.location = 'cart.php?a=remove&r='+type+'&i='+num; } } {/literal} </script>
the problem work, results not visable. because page need refreshed see product removed.
is there way change script, page reloaded? or better, product removed using ajax, without refreshing page?
for reload page ajax use
location.reload();
all code looks
<script> {literal} function removeitem(type,num) { var response = confirm("{/literal}{$lang.cartremoveitemconfirm} {literal}"); if (response) { window.location = 'cart.php?a=remove&r='+type+'&i='+num; location.reload(); } } {/literal} </script>
Comments
Post a Comment