doulin6448 2017-09-05 19:19
浏览 91
已采纳

当我放在正文之前但是在标题中工作时,Javascript无法正常工作

for some odd reason my console is showing "[Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience."

I know that is has something to do with how I am double loading my scripts but website only seems to function perfectly when I add both the scripts in the header and before the body. When I try to add my scripts only in the body before the the closing tag my javascript completely stop working, im using mostly jquery for everything and my whole custom.js is wrapped in the $(document).ready() i dont understand

so heres how I load my script and and it works fine I add

<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<script src="https://js.pusher.com/3.0/pusher.min.js"></script>
<script src="bootstrap2/js/bootstrap.min.js"></script>
<script src="js/custom.js" type="text/javascript"></script>

to the header

This is the script that I place before my closing body tag

<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<script src="bootstrap2/js/bootstrap.min.js"></script>
<script src="js/custom.js" type="text/javascript"></script>

</body> 

so the deprecation messages disappears when i added it all to the closing body tag so im sure it has something to do with it maybe it has something to do with the order but i cant figure it out

  • 写回答

1条回答 默认 最新

  • douya7121 2017-09-05 20:00
    关注

    You have to load jQuery library before loading jQuery-UI library since it is dependent on it. Even I had faced the same error when I started my career!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度