Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix the jquery url.indexOf function not defined at jQuery.fn.init.jQuery?

I have developed a web application application in MVC using jQuery.

Now I am getting this error again and again. I don't know what I am missing right now.

Can anyone guide me about this?

It throws this error message in browsers' console:

jQuery.Deferred exception: url.indexOf is not a function TypeError: url.indexOf is not a function

at jQuery.fn.init.jQuery.fn.load (http://localhost:5713/Scripts/jquery-3.1.1.js:9793:13)
at HTMLDocument. (http://localhost:5713/Theme/js/main.js:27:12)
at mightThrow (http://localhost:5713/Scripts/jquery-3.1.1.js:3570:29)
at process (http://localhost:5713/Scripts/jquery-3.1.1.js:3638:12) undefined jQuery.Deferred.exceptionHook @ jquery-3.1.1.js:3846
jquery-3.1.1.js:3855 Uncaught TypeError: url.indexOf is not a function
at jQuery.fn.init.jQuery.fn.load (jquery-3.1.1.js:9793)
at HTMLDocument. (main.js:27)
at mightThrow (jquery-3.1.1.js:3570)
at process (jquery-3.1.1.js:3638)

like image 609
user6306245 Avatar asked Dec 02 '22 12:12

user6306245


1 Answers

With Jquery 3.x there were some breaking changes in the Library

Jquery Breaking Changes

Jquery Removed the load,unload and error event listeners completely, although they were deprecated long back in Jquery 1.8.

use .on to register your event.

like image 151
Shekhar Pankaj Avatar answered May 26 '23 13:05

Shekhar Pankaj