vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   [Ajax] Best Answer not work on 4.2.5 (https://vborg.vbsupport.ru/showthread.php?t=329635)

S!p 07-17-2023 11:24 AM

[Ajax] Best Answer not work on 4.2.5
 
Hello,
i`m trying to install https://vborg.vbsupport.ru/showthread.php?t=322478 on 4.2.5
The button is visable in showthread, but after press on it, nothing happend.

My browser is showing error: Uncaught ReferenceError: jQuery is not defined
at bestAnswer.js:43:4
Code:

(function ($, window) {
    var $btn;
    var postId;
    var threadid = ($("input[name='threadid']")[0] || $("input[name='searchthreadid']")[0]).value;
    var baseUrl = window.getBaseUrl() + 'bestAnswer.php';
   
    var onSelectSuccess = function () {
        $bestAnswerContainer = $btn.closest('.bestAnswer_container');
        $('.selectBestAnswer').hide();
        $bestAnswerContainer
            .find('.unselectBestAnswer')
            .show();       

    }
   
    var onUnselectSuccess = function () {
        $bestAnswerContainer = $btn.closest('.bestAnswer_container');
        $('.selectBestAnswer').show();
        $('.unselectBestAnswer').hide();
    }   
   
   
    window.onSelectBestAnswer = function (postid, btn) {
        $btn = $(btn);
        postId = postid;
        $.ajax({
            url: baseUrl + '?do=selectBestAnswer&postid=' + postid + '&threadid=' + threadid,
            success: onSelectSuccess
        });
    }
   
    window.onUnselectBestAnswer = function (postid, btn) {
        $btn = $(btn);
        postId = postid;
        $.ajax({
            url: baseUrl + '?do=unselectBestAnswer&postid=' + postid + '&threadid=' + threadid,
            success: onUnselectSuccess
        });
    }
            var script = document.createElement('script');
        script.src = 'https://code.jquery.com/jquery-3.6.3.min.js';
        document.getElementsByTagName('head')[0].appendChild(script);
})(jQuery, window)

Line 43: in .js file: (jQuery, window)
How can I fix it?

Hostboard 07-18-2023 11:44 PM

What is your setting under:

ACP > Options > Server Settings and Optimization Options > Use Remote jQuery


All times are GMT. The time now is 10:11 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00945 seconds
  • Memory Usage 1,718KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete