jquery - How to use $ with externally loaded javascript

I'm trying to load an external javascript file that uses jquery but references it with '$'. Through some

I'm trying to load an external javascript file that uses jquery but references it with '$'. Through some digging around, I've cobbled together the following:

jQuery(document).ready(function(){
    (function($) {
        $.getScript('.min.js', function() {
            var widget = new TimekitBooking();
            widget.init({
                app_key: 'test_widget_key',
                project_id: '1234'
                // optional configuration here.. (read more under: configuration)
            });
        });
    })( jQuery );       
});

I've then enqueued this script in the footer. However, I keep getting the error 'TypeError: $ is undefined' in line 45 of the loaded script and lines 10 and 15 of this one.

Is this the best method of achieving what I want, and if so, what am I doing wrong?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745227966a4617549.html

相关推荐

  • jquery - How to use $ with externally loaded javascript

    I'm trying to load an external javascript file that uses jquery but references it with '$'. Through some

    5小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信