another .post issue

another .post issue

Hello,

I have run into another issue with the $.post call.  It does not seem to be returning any information.  In the below code you will see that I am passing two variables through post to a separate php file.  

  1. $("#myform").submit(function(event){
  2. event.preventDefault();
  3. var user = document.myform.userid.value;
  4. var pass = document.myform.password.value;
  5. $.post("vallog.php",{ username: user, password: pass},  function(data){
  6. console.log(data.test);
  7. if(data.validate == "passed"){
  8. passed();
  9. }
  10. else{
  11. failed();
  12. }
  13. });
  14. });
The vallog.php file assigns the test value before it does anything else, so it should work.  when i navigate directly to the php file it gives me the below output
  1. {"test":"it worked","valiate":"failed"}
now if i submit the page that has the .post on it console.log writes an undefined value. Which leads me to believe that it is not returning any data, and I am not sure why.  Any help is greatly appreciated.