DEV Community

Kellog Gullati
Kellog Gullati

Posted on

Connecting HTML to database through javascript

I want to connect to a PostgreSQL databse through javascript and then call it from HTML.
I am able to connect the database to a standalone javascript function, but it's not working when called from HTML. Has anybody done this? If you have a sample code, please share if you can.

The error I'm receiving:

Uncaught Error: Module name "path" has not been loaded yet for context: _. Use require([])
https://requirejs.org/docs/errors.html#notloaded
    at makeError (require.js:168:17)
    at Object.localRequire [as require] (require.js:1436:44)
    at requirejs (require.js:1797:24)
    at myFunction (index.js:2:16)
    at HTMLButtonElement.onclick (index.html:11:40)
Enter fullscreen mode Exit fullscreen mode

I've already downloaded Require.js and installed path.

Top comments (0)