Javascript, if it is running in a browser, does not have access to the MySQL database. Firstly, this is a technical limitation, because Javascript is not able to transmit arbitrary protocols (no, WebSockets is not a solution). Please note that Node.js, which is server-side and everything, is a "different kind of javascript."
Then there is a security problem. If your javascript can directly access the database, I could easily access the database myself. I could read and manipulate the same data that your javascript can use. Security, calling it a nightmare, would be a euphemism.
You will have to - and WANT - to route access to the database through the server-side application. If this application is written in PHP, C # or Assembly is not a big deal. With Node.js, you can even use server-side Javascript. Use what is convenient for you.
rodneyrehm
source share