currently have select dropdown filter setup via php this:
<?php if($this->config->get("config_show_tmall_only")){?> <?php if(isset($code) && $code=="tmall"){?> <select id="tmallfilter"> <option value="&code=tmall">tmall only</option> <option value="">taobao & tmall</option> </select> <?php }else{?> <select id="tmallfilter"> <option value="">taobao & tmall</option> <option value="&code=tmall">tmall only</option> </select> <?php }?> <?php }?> it detects if &code=tmall in url , runs first block
i appending &code=tmall through script runs how need
$('#tmallfilter').bind('change', function () { var brwsr_url=document.url; var redirecturl= brwsr_url + $(this).val(); location.href = redirecturl; }); the problem running when need go taobao & tmall can add url, not strip characters based on select.
is there way can strip &code=tmall url when select taobao & tmall option?
this strip away &code=tmall using string.replace:
$('#tmallfilter').bind('change', function () { var brwsr_url = document.url; var redirecturl= brwsr_url.replace(/&code=tmall/, '') + $(this).val(); location.href = redirecturl; });
Comments
Post a Comment