How to fix '$.extend is not a function' error in nodejs

51
May 19, 2019, at 2:10 PM

I have SPAs. I use nodejs + mongoDb. In the end of my SPAs, I have contact form. When visitor fill the contact form and click submit button. I received an E-mail. Everythings fine until here. I want to show notification for visitor. and I decided to use toastr. When I click submit button. I getting an error. "$.extend is not a function".

In npm web site, toastr say before the toastr.js include jquery. I include jquery. but nothing I getting same error.

app.js call trycontroller.

tryController(app);

tryContoller

// I installed jquery from npm 
const jquery = require('jquery');
const toastr = require('toastr');
app.post('/', urlencodedParser, function (req, res) {
        console.log(req.body);
        main(req.body.nameContact, req.body.emailContact, req.body.subjectContact, req.body.messageContact)
            .then(() => {
                console.log("Email Sended");  
                toastr.success('Have fun storming the castle!', 'Miracle Max Says')
                res.redirect('#contactForm');
            }, err => { 
                console.log("Email Error: " + err) })
            .catch(console.error);
    });

and this my index.ejs


<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.0.1/js/toastr.js"></script>
READ ALSO
Object animation with constrained views

Object animation with constrained views

Is there a way to animate a view with other views constrained to it, that the other views will follow the animated view? Like i want to set animation for 1 object and the rest would moce along it by constraints?

39
How to use variable in another file?

How to use variable in another file?

I want to pass an variable to another fileI use the lat variable in new js file but not working

24
How do I access a particular part of an HTML tag?

How do I access a particular part of an HTML tag?

I am using console on google chrome to edit the web pageI could just use inspect element and change what I am trying to change, but after discovering I could do this on the console

18