JavaScript runtime error: '$' is undefined

前端 未结 6 1340
后悔当初
后悔当初 2020-12-16 18:22

So classic problem, but having a horrible time on finding the actual cause. Typically when I see this error it\'s because the jQuery reference is after code requiring it, or

6条回答
  •  太阳男子
    2020-12-16 18:30

    In my case, the problem was that I was rendering my page over https but I was trying to request the JQuery file over http, which is blocked by many browsers for security reasons.

    My fix was to change this...

    
    

    ...to this...

    
    

    This causes the browser to download JQuery using the same protocol (http or https) as the page being rendered.

提交回复
热议问题