Skip to content
Advertisement

how to connect to sql database with js

I have form that to registering some site. I want to check when user is writing username code will check that have or not in database

Advertisement

Answer

You must use AJAX for this. The SQL database you speak of is on the host, not on the computer that is running the JavaScript.

When the user completes the registration page, you’ll use AJAX to send the request to the host. The host might reply with an error response: “user already exists.” It(!) is querying the database, which it(!) has access to, to determine this.

And … if I may say … “the Internet is positively stuffed with examples already!” Check out https://w3schools.com for some of the very-best free tutorials out there. Good luck!

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement