I hope its possible. Here's what I want to achieve. I have a register form that has fields for user info. and a button, in button onclick arguments it will call a javascript function. This function will check if the password field and confpassword field are the same if so call a php file where it has a function that check if the username inputted by the user already exist in the database if so prompt a message that username already used.

How can I do that?

Thanks in advance guys.