Ajax脚本强制页面继续重新加载

I have a page which uses some ajax code which calls a php page to see if the user is logged in, the php page the returns a value and the javascript behaves accordingly.

Now this works in theory, the problem is the page keeps loading and refreshing and i can not work out why.

here is my ajax code.

  $(document).ready(function() {

  $.ajax({    //create an ajax request to load_page.php
    type: "GET",
    url: "logincheck.php",             
    dataType: "html",   //expect html to be returned                
   success: function(response){                     
        if(response == "a")
                    {

                     $("#responsecontainer").html(response);    

                    window.location.href = "menu.html"; 

                    }
                    // Login failed
                    else
                    {
                        window.location.href = "testz.html";  
                    }


        //alert(response);
    }
  });
       });

and my php code.

      include("include/session.php");
      if($session->logged_in){  
          echo "a";
            }
            else 
           {
           echo"b"; 
           }