Hello, I'm trying to send a new user info (username & password) to a php file (register_check_0.php) using ajax with jquery so i can check if user already exists. I use the post request below:
$.post("register_check_0.php",
{
username: $("#username").val(),
password: $("#password").val()
},
function(data,status){
var result=data;
if(result=="success"){
counter+=1;
$("#registration").load("register_1.php");
}
}
);
This is my php file:
<?php
//require_once('testfile.php');
$username=$_POST['username'];
$password=$_POST['password'];
if($username == "user"){echo "success";}else{echo "fail";}
?>
The testfile.php is empty, my code as is now, works fine. If type user in my form the result to ajax post request is success, but when i include the testfile.php it does not work.
**All files are at the same directory
Thank you in advance.