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?
Hi@colt0356,
Simply you should load (enqueue) the wpdiscuzAjaxObj with the js file.
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
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)