bbq removestate without affecting

1.3k Views Asked by At

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?

1

There are 1 best solutions below

0
On

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.