仅使用Jquery地址添加一次

时间:2014-09-09 23:35:53

标签: javascript jquery

我正在使用http://www.asual.com/jquery/address/

我在这里看到过如何将哈希切换为另一个值,我已经完成了

    $.address.state('s');

这被调用一次,并且工作正常。

然后我为每个页面更改添加ID

    $.address.value( id );  

第一次工作正常。我遇到的麻烦是每次更改页面时都会添加s get,即

  1. example.com/s/1
  2. example.com/s/s/2
  3. 如何获得example.com/s/2的任何想法?

1 个答案:

答案 0 :(得分:0)

这样做了

$.address.state('/');
// switching off auto update in order to avoid adding value to the browser history
$.address.autoUpdate(false);
$.address.value(document.location.pathname+document.location.search);
$.address.autoUpdate(true);