请参阅另一页

时间:2016-03-29 15:03:27

标签: jquery html

请帮助它的工作。它总是引用“404 Not Found”的页面。

enter image description here

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment-with-locales.js"></script>
<script src="//cdn.rawgit.com/Eonasdan/bootstrap-datetimepicker/e8bddc60e73c1ec2475f827be36e1957af72e2ea/src/js/bootstrap-datetimepicker.js"></script>

<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<link href="//cdn.rawgit.com/Eonasdan/bootstrap-datetimepicker/e8bddc60e73c1ec2475f827be36e1957af72e2ea/build/css/bootstrap-datetimepicker.css" rel="stylesheet"/>

<div style="overflow:hidden;">
    <div class="form-group">
        <div class="row">
            <div class="col-md-8">
                <div id="datetimepicker"></div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $(function () {
            $('#datetimepicker').datetimepicker({
                inline: true,
                sideBySide: true,
                daysOfWeekDisabled: [0, 6]
            });
        });
    </script>
</div>
 function GoTo(){

        var input_1 = $("input[name='keyword']").val();
        var input_2 = $("input[name='location']").val();

        if(input_1 !== "" || input_2 !== "")
        {
            window.location.href = "page2.html";
        }
    }

2 个答案:

答案 0 :(得分:1)

只需在链接的开头添加“/”,这样就会相对于你的根

window.location.href= "/page2.html"

答案 1 :(得分:0)

主要问题是我在我的网页中使用的 base 标记内。我也改变了我的js代码:

&#13;
&#13;
<script>
    $('.search').click(function(event){
        event.preventDefault();
        window.location.href='./grid.html';
    });
</script>
&#13;
&#13;
&#13;