在JS中重新加载页面后URL参数出现问题

时间:2019-06-13 18:01:00

标签: javascript jquery

我有此代码:

<form novalidate method="get"
      action=" http://domain.test/result?s_city=&amp;s_name=&amp;s_phone=&amp;s_price=3&amp;s_price_from=&amp;s_price_to=182&amp;s_province=&amp;s_weight_from=&amp;s_weight_to=&amp;s_year_birth_from=&amp;s_year_birth_to=&amp;work_now=1 "
      class="form-horizontal removeAction" id="searchAction">
    <div class="col-xs-12 col-sm-6 col-md-6 col-lg-4 ">
        <select class="selectpicker indexSelect1 filterMenu3  callendarFilter callendarFilterCategory"
                name="sortAfter" onchange="this.form.submit()">
            <option value="">Sortuj według</option>
            <option value="1">
                Sort A-Z
            </option>
            <option value="2">
                Sort Z-A
            </option>
            <option value="3">
                Sort from newest
            </option>
            <option value="4">
                Sort from oldest
            </option>
        </select>
    </div>
</form>

当我从select / option中选择一个选项时-然后是重新加载页面后我所拥有的而不是保存在form-> action中的参数:

http://domain.test/result?sortAfter=3

代替:

http://domain.test/result?s_year_birth_from=&s_year_birth_to=&s_province=&s_city=&s_weight_from=&s_weight_to=&s_price=3&s_price_from=&s_price_to=182&work_now=1&s_phone=&s_name=

(URL链接中的参数丢失)。

有人知道如何解决吗?

0 个答案:

没有答案