TypeError: url.indexOf is not a function ,使用jquery load()出现错误

转自:https://blog.csdn.net/cvper/article/details/79150566

问题:在使用  jquery 3.3.1  版本时,写了如下测试代码:

                       <script>

                              $(window).load(function(){

                              console.log("just a test!");

                              });

                      </script>

               运行出错:TypeError: url.indexOf is not a function ..........


原因:  .load() ,  .error() ,  .unload() ,已经不在支持,jquery1.8版本之后的都无法再使用;


解决办法:使用  .on("load",function(){.................}) 来代替  .load()  即可;

原文地址:https://www.cnblogs.com/whatstone/p/11956294.html