{"id":16864627,"date":"2023-07-03T08:02:50","date_gmt":"2023-07-03T08:02:50","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/js-errors-26\/"},"modified":"2023-07-03T08:02:50","modified_gmt":"2023-07-03T08:02:50","slug":"js-errors-26","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/js-errors-26\/","title":{"rendered":"JS errors"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">I&#8217;ve been looking at error logs and noticed a lot of javascript reference errors coming from Paysera plugin. The underlying issue is pretty simple:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Plugin is loading <strong>assets\/js\/delivery\/frontend.ajax.js<\/strong> file which depends on jQuery:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>jQuery(document).ready(function($) {\n    $('.paysera-delivery-terminal-country-selection').on('select2:select', function (e) {\n...<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This file is registered in <strong>woo-payment-gateway-paysera\/src\/PayseraInit.php<\/strong>, but a dependency for jQuery is not specified:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wp_register_script(\n            'paysera-delivery-frontend-ajax-js',\n            PayseraPaths::PAYSERA_DELIVERY_FRONTEND_AJAX_JS,\n            &#091;], \/\/ missing jquery dependency.\n            false,\n            true\n        );<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">When jQuery is loaded after the the <strong>frontend.ajax.js<\/strong> a script throws a reference error. <\/p>\n","protected":false},"template":"","class_list":["post-16864627","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/16864627","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/16864627\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=16864627"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}