Error: Uncaught TypeError: url.indexOf is not a function by Jquery


In the browser, I check in inspect item, and I get the following error:


Uncaught TypeError: url.indexOf is not a function

I imagine it's because of a function I use Jquery, which is the following:

var baseUrl = '<%= ResolveUrl("~/") %>';
$("#subpagina").html("cargando").load(baseUrl + "Home/Inicio", function () {                

I would like to know what I should do, or how to update the jQuery function.

asked by Danilo 19.08.2016 в 04:41

2 answers


Update all parts of your code that have the function load

$(window).load(function() { ... });

To the following:

$(window).on('load', function() { ... });

Taken from an original StackOverflow publication here .

answered by 19.08.2016 в 04:47

As of jQuery 3.0 the methods .load() , .unload() and .error() were removed due to some conflicts that caused, and if they wish to use it must be done by means of .on() :

.on('load', fn)

.on('error', fn)

.on('unload', fn)

Here is the official note in English

In case you can not / want to rewrite the code, you can also use the jQuery migrate plugin.

answered by 19.08.2016 в 05:24