1

How do I remove state fragment search?

state: #tab=2&search=true

$(textbox).click(function()
{
    var state = {};
     //$.bbq.removeState("search");
    state['tab'] = $(this).val();
    $.bbq.pushState(state);
});

If I uncomment the removeState line, it will first create a new state consisting of tab=2 replacing it with a new state tab1. How can I just remove the search fragnment and replace tab=2 with tab=1 in 1 new state?

James Allardice
  • 164,175
  • 21
  • 332
  • 312
user730108
  • 109
  • 1
  • 10

1 Answers1

3

You can use overload method

$.bbq.pushState(state, 2);

which replaces completely to new state.

Also note that $.bbq.removeState() as $.bbq.pushState() triggers hashchange event. It may give you unexpected results.

Agnius101
  • 61
  • 4