@sergo573

Как исправить ошибку (Uncaught TypeError: e.indexOf is not a function) в консоле?

После обновления woocommerce, в консоли появилась ошибка:
Uncaught TypeError: e.indexOf is not a function
    at S.fn.init.S.fn.load (jquery.min.js?ver=3.6.0:2:84932)
    at new S.fn.init (jquery.min.js?ver=3.6.0:2:25740)
    at S (jquery.min.js?ver=3.6.0:2:1051)
    at Object.setupPaging (jquery.flexslider.min.js?ver=2.7.2-wc.6.1.0:1:4866)
    at Object.setup (jquery.flexslider.min.js?ver=2.7.2-wc.6.1.0:1:4464)
    at Object.init (jquery.flexslider.min.js?ver=2.7.2-wc.6.1.0:1:2106)
    at new v.flexslider (jquery.flexslider.min.js?ver=2.7.2-wc.6.1.0:1:21309)
    at HTMLDivElement.<anonymous> (jquery.flexslider.min.js?ver=2.7.2-wc.6.1.0:1:22487)
    at Function.each (jquery.min.js?ver=3.6.0:2:3003)
    at S.fn.init.each (jquery.min.js?ver=3.6.0:2:1481)


И появилось предупреждение:
jQuery.Deferred exception: e.indexOf is not a function TypeError: e.indexOf is not a function
    at S.fn.init.S.fn.load (/wp-includes/js/jquery/jquery.min.js?ver=3.6.0:2:84932)
    at new S.fn.init (/wp-includes/js/jquery/jquery.min.js?ver=3.6.0:2:25740)
    at S (/wp-includes/js/jquery/jquery.min.js?ver=3.6.0:2:1051)
    at Object.setupPaging (/wp-content/plugins/woocommerce/assets/js/flexslider/jquery.flexslider.min.js?ver=2.7.2-wc.6.1.0:1:4866)
    at Object.setup /wp-content/plugins/woocommerce/assets/js/flexslider/jquery.flexslider.min.js?ver=2.7.2-wc.6.1.0:1:4464)
    at Object.init (/wp-content/plugins/woocommerce/assets/js/flexslider/jquery.flexslider.min.js?ver=2.7.2-wc.6.1.0:1:2106)
    at new v.flexslider (/wp-content/plugins/woocommerce/assets/js/flexslider/jquery.flexslider.min.js?ver=2.7.2-wc.6.1.0:1:21309)
    at HTMLDivElement.<anonymous> (/wp-content/plugins/woocommerce/assets/js/flexslider/jquery.flexslider.min.js?ver=2.7.2-wc.6.1.0:1:22487)
    at Function.each (/wp-includes/js/jquery/jquery.min.js?ver=3.6.0:2:3003)
    at S.fn.init.each (/wp-includes/js/jquery/jquery.min.js?ver=3.6.0:2:1481) undefined


Из-за этих ошибок на странице товара не грузятся картинки товара.
Я так понимаю, ругается на версию jquery? Или нет? В общем, кто сталкивался, как решить данную проблему?
  • Вопрос задан
  • 2016 просмотров
Решения вопроса 1
@sergo573 Автор вопроса
Если у кого проблема схожая, тут идет разбор данной проблемы:
https://wordpress.org/support/topic/jquery-conflic...
Ответ написан
Пригласить эксперта
Ответы на вопрос 1
ProgrammerForever
@ProgrammerForever
Учитель, автоэлектрик, программист, музыкант
indexOf предполагает строку или массив. Видимо e не является ни тем, не другим, а, например null или undefined.
Возможно стоит искать тут:

Если url не передан, или передан неверно - будет такая ошибка
// https://code.jquery.com/jquery-3.5.0.js
/**
 * Load a url into a page
 */
jQuery.fn.load = function( url, params, callback ) {
	var selector, type, response,
		self = this,
		off = url.indexOf( " " );

	if ( off > -1 ) {
		selector = stripAndCollapse( url.slice( off ) );
		url = url.slice( 0, off );
	}

	// If it's a function
	if ( isFunction( params ) ) {

		// We assume that it's the callback
		callback = params;
		params = undefined;

	// Otherwise, build a param string
	} else if ( params && typeof params === "object" ) {
		type = "POST";
	}

	// If we have elements to modify, make the request
	if ( self.length > 0 ) {
		jQuery.ajax( {
			url: url,

			// If "type" variable is undefined, then "GET" method will be used.
			// Make value of this field explicit since
			// user can override it through ajaxSetup method
			type: type || "GET",
			dataType: "html",
			data: params
		} ).done( function( responseText ) {

			// Save response for use in complete callback
			response = arguments;

			self.html( selector ?

				// If a selector was specified, locate the right elements in a dummy div
				// Exclude scripts to avoid IE 'Permission Denied' errors
				jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :

				// Otherwise use the full result
				responseText );

		// If the request succeeds, this function gets "data", "status", "jqXHR"
		// but they are ignored because response was set above.
		// If it fails, this function gets "jqXHR", "status", "error"
		} ).always( callback && function( jqXHR, status ) {
			self.each( function() {
				callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
			} );
		} );
	}

	return this;
};

Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы