新手请教一下很简单ajax问题谢谢

请问一下Servlet返回字符串,再前端console里面没有显示信息而是跳转新的页面是怎么回事(我引用了jquery)

</body>
<script>
    $(function(){
    $("#loginBtn").click(function(){

     var $username = $("#username").val();
     var $password = $("#password").val();
         $.ajax({
            type:'get',  
            url:'login', 
            data:"username="+$username+"&password="+$password,
            success:function(msg){
                console.log(msg);
            },
            error:function(xhr){  
                console.log(xhr);
            }
         });
    })})
    </script>


    这里是后台代码:
    String username=request.getParameter("username");
    String password= request.getParameter("password");
    User loginUser = UserService.login(u);
    if(loginUser!=null) {
             response.getWriter().print("ture");
        }else {
              response.getWriter().print("flase");

https://bbs.csdn.net/topics/360240037