CodeSeven / toastr

Simple javascript toast notifications
http://www.toastrjs.com
MIT License
11.96k stars 2.04k forks source link

Cannot read property 'extend' of undefined #677

Closed JohnRDOrazio closed 2 years ago

JohnRDOrazio commented 2 years ago

I am getting this error when trying to use toastr served from cdnjs. I am not using node, I am not importing packages. I serve jQuery on all my pages from the Google Ajax Repository CDN. So jQuery is available and loaded before toastr. However when trying to create a toast I am getting this error:

Uncaught TypeError: Cannot read properties of undefined (reading 'extend')
    at m (toastr.js:474)
    at Object.i [as success] (toastr.js:474)
    at Object.success (extending.js:712)
    at c (jquery.min.js:2)
    at Object.fireWith [as resolveWith] (jquery.min.js:2)
    at l (jquery.min.js:2)
    at XMLHttpRequest.<anonymous> (jquery.min.js:2)
m @ toastr.js:474
i @ toastr.js:474
success @ extending.js:712
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
l @ jquery.min.js:2
(anonymous) @ jquery.min.js:2
JohnRDOrazio commented 2 years ago

Sorry my bad, I noticed that there was a glitch in my setup where toastr was actually getting loaded before jQuery. Once I fixed that it worked perfectly.