The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
Search
Close
AI Search
Classic Search
 Search Phrase:
 Search Type:
Advanced search options
 Search in Forums:
 Search in date period:

 Sort Search Results by:

AI Assistant
Uncaught ReferenceE...
 
Share:
Notifications
Clear all

Uncaught ReferenceError: wpdiscuzAjaxObj is not defined

5 Posts
3 Users
0 Reactions
2,269 Views
Posts: 2
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@colt0356)
New Member
Joined: 6 years ago
[#518]

Hello, im trying to Lazy Load Wpdiscuz. So i first dequeue the wpdiscuz-combo.min.js in my functions.php and then i made another script to load the script 2 seconds after everything is loaded in the website.

However when the script is loaded i get the error Uncaught ReferenceError: wpdiscuzAjaxObj is not defined

 

How can i fix this?


4 Replies
Asti
Posts: 8210
 Asti
Support
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@asti)
Illustrious Member
Joined: 8 years ago

Hi@colt0356,

Simply you should load (enqueue) the wpdiscuzAjaxObj with the js file. 


Reply
Posts: 2
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@colt0356)
New Member
Joined: 6 years ago

And how am i going to do that?

var wpdiscuzAjaxObj = "https://www.abnehmenclub.de/wp-content/plugins/wpdiscuz/utils/ajax/wpdiscuz-ajax.php";

 

doesnt work


Reply
1 Reply
Asti
 Asti
Support
(@asti)
Joined: 8 years ago

Illustrious Member
Posts: 8210
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@colt0356,

wpdiscuzAjaxObj is a global object that includes all wpDiscuz options that necessary for using wpDiscuz js code. You've simply passed the URL, that's wrong. Please see how the object is used in wpDiscuz files and in the same way load (enqueue) it. 

In the code, the wpdiscuzAjaxObj is localized, so if you can find and load (enqueue) the object, it'll work fine. 

More info here: https://developer.wordpress.org/reference/functions/wp_localize_script/


Reply
Posts: 1
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@larryhems)
New Member
Joined: 4 years ago

If you are using any script file and getting "Uncaught ReferenceError: 'wpdiscuzAjaxObj' is not defined " which means ‘wpdiscuzAjaxObj’ is either a variable or a method which you are trying to use before declaring it using var keyword. This means that there is a non-existent variable referenced somewhere. This variable needs to be declared, or you need to make sure it is available in your current script or scope otherwise , it will endup throwing this ‘wpdiscuzAjaxObj’ is not defined error . This usually indicates that your library is not loaded and JavaScript does not recognize the ‘wpdiscuzAjaxObj’.

To solve this error: Load the jQuery CDN library at the beginning of all your javascript files/scripts which uses $/ jQuery, so that $/jQuery can be identified in scripts .

There can be multiple other reasons for this issue:

  • Conflict with Other Libraries
  • Path to your library included is not correct
  • Llibrary file is corrupted
  • Working offline (when you use CDN)

 


Reply
Share: