.post issue

.post issue

Hi I am having some problems using .post in the below code.  I am calling the .post in the same file.  So the below code in the login.php file is calling itself, and that might be part of the problem.  I do not know.  Basically the below code works, but it updates the source, but it will not refresh the page, so any elements will not be added to the page.  I can tell the source is updated because in chrome if I go to inspect element it shows up in the resources tab, but it does not show up in the elements tab.  If I remove the event.preventDefault() it ignores my js code, but the second code works fine. 


  1. $("#myform").submit(function(event){
  2. event.preventDefault();
  3. var user = document.myform.userid.value;
  4. var pass = document.myform.password.value;
  5. $.post("login.php",{ username: user, password: pass});
  6. });
The part that is not working in a different part of the code.  

  1. $("#login").append("<span><?php echo $_POST["username"]?></span>");