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.
- $("#myform").submit(function(event){
- event.preventDefault();
- var user = document.myform.userid.value;
- var pass = document.myform.password.value;
- $.post("login.php",{ username: user, password: pass});
- });
The part that is not working in a different part of the code.
- $("#login").append("<span><?php echo $_POST["username"]?></span>");