Including mongo db in html file

Including mongo db in html file
0

#1

Basically I’m trying to make a page in my url-shortener site that lists the contents of the database. However, I can’t get the html file to load a script that requires mongo. I tried to simplify the code as much as possible to isolate the issue:

list.html file:

> <!DOCTYPE html>
> <html>
> <body>
>     <p class="tagline">From Cloud9 IDE!</p>
>     <script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
>     <script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
>     <script src="site.js"></script>
> </body>
> </html>

site.js file:

//var mongodb = require(‘mongodb’);
$(".tagline").click(function() {
alert(“jQuery works!”);
});

When the ‘var mongodb…’ line is commented out, the code works. Otherwise the message doesn’t popup. Maybe there is some way to load mongo in a script in the html file? But I can’t find anything by googling. Does anyone have any suggestions?

Thanks


#3

Oh that makes sense, thanks. I check out that course but it might be a little advanced for me at this point.