Uncaught TypeError: $.getScript(...).done is not a function

1.2k views Asked by At

I faced a weird situation here..

.

Below code is working:

// this code working perfectly

$.getScript( "https://wchat.freshchat.com/js/widget.js" ).done(( script, textStatus )=>{
    // run something
});

.

.

But if I put the whole code inside setTimeout it will give error in browser console

// this will give error in browser console

setTimeout(()=>{
    $.getScript( "https://wchat.freshchat.com/js/widget.js" ).done(( script, textStatus )=>{
        // run something
    });
}, 4000);

and it will give error in browser console:

enter image description here

What is the problem?

1

There are 1 answers

0
Pavlo Oliinyk On

I had the same issue when update Bootstrap v4.0 to v4.3.1

To fix it you need to use jQuery without slim postfix. (Use jquery-3.3.1.min.js instead of jquery-3.3.1.slim.min.js)