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!

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

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大