-2

Possible Duplicate:
Can JavaScript connect with MySQL?

I have a database with names and emails. When the user fills a email input field with a email. JS checks it with the database and writes out persons name after he completed the email in the field.

[email protected] Welcome John Doe!

Is it Possible to retrieve MySQL Database data using JavaScript?

Any help would be appreciated.

1
  • Fortunately, JavaScript doesn't have direct access to the database. Otherwise, it was was a godsend for hackers. It only has access to resources located on the client side. Commented May 3, 2012 at 9:25

2 Answers 2

5

Assuming a typical browser environment (since you specify client side code), no, and it would be insane to expose the database in a way that would grant a browser such permissions if it were possible.

Write a web service that the browser can interact with by using Forms or Ajax to make HTTP requests instead.

(Aside: If you hadn't specified client side, then node js can do it).

Sign up to request clarification or add additional context in comments.

Comments

0

No. For doing such a thing, you need a server for that. What you could do, if the database resides on the same machine as the client, is using IndexedDB, giving you a means of accessing a local DB (which is a NoSQL-DB).

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.