windowiaoqs.location.href不要和form标签一起使用

表单代码

<form>
    <div class="form-group">
        <label for="tel">电话号码</label>
        <input type="text" class="form-control" id="tel" placeholder="请输入你的电话号码">
    </div>
    <div class="form-group">
        <label for="calltime">Password</label>
        <input type="text" class="form-control" id="calltime" placeholder="请输入查询的时间">
    </div>
    <button class="btn btn-default" onclick="queryData()">查询</button>
</form>

JS函数代码

<script>

    function queryData(){
        window.location.href = "/view?tel="+$("#tel").val()+"&calltime="+$("#calltime").val();
    }
</script>


结果是无法跳转页面

如果执行到这一步,那就试试下面的方法:

把form元素换成div标签

如果,如果,如果还不行,那你就仔细看看,是不是,是不是你的单词拼错了,,,w i n d o w . l o c a t i o n . h r e f =

猜你喜欢

转载自blog.csdn.net/m0_55868614/article/details/121114867
今日推荐