2017-05-17 90 views
0

我有一个下面的代码附加URL。代码正常工作。然而,replaceState并没有像我想的那样工作。基本上,我只是希望页面不会重新加载/刷新时,URL附加文本。任何建议如何解决这个问题?通过replaceState追加Url防止页面重新加载

<script> 
    $(document).ready(function() { 
     $("#staff-list").on('change', function() { 
     history.replaceState(null, null, location.href = "?account=" + $(this).val()); 
     }); 
    }); 
    </script> 

回答

0

我刚刚算出来了。无论如何,我会在这里张贴未来的编码人员,他们碰巧寻求类似问题的答案。

<script> 
    $(document).ready(function() { 
     $("#staff-list").on('change', function() { 
     history.replaceState(null, null, "?account=" + $(this).val()); 
     }); 
    }); 
    </script>