Mekaboo Posted September 6, 2021 Share Posted September 6, 2021 Hey all!! Uncaught ReferenceError: jQuery is not defined jQuery 2 I added the most recent JQuery(standalone and CDN) and still getting this error. How do I get rid of this please? Thank ya☺️ Link to comment Share on other sites More sharing options...
Ingolme Posted September 6, 2021 Share Posted September 6, 2021 Without seeing any of your code it is hard to know what is causing the problem. This could happen if your <script> tag occurs before the <script> tag which loads the jQuery library. 1 Link to comment Share on other sites More sharing options...
Mekaboo Posted September 7, 2021 Author Share Posted September 7, 2021 (edited) Sorry about that @Ingolme [code] <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <script type="text/javascript" src="js/jquery-3.2.1.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ windowOnScroll(); }); function windowOnScroll() { $(window).on("scroll", function(e){ if ($(window).scrollTop() == $(document).height() - $(window).height()){ if($(".post-item").length < $("#total_count").val()) { var lastId = $(".post-item:last").attr("id"); //getMoreData(lastId); } } }); } function getMoreData(lastId) { $(window).off("scroll"); $.ajax({ url: 'getMoreData.php?lastId=' + lastId, type: "get", beforeSend: function () { $('.ajax-loader').show(); }, success: function (data) { setTimeout(function() { $('.ajax-loader').hide(); $("#post-list").append(data); windowOnScroll(); }, 1000); } }); } </script> [/code] Edited September 7, 2021 by Mekaboo Link to comment Share on other sites More sharing options...
Ingolme Posted September 7, 2021 Share Posted September 7, 2021 Just running that code in my own HTML document does not result in any errors. You shouldn't include the jQuery library twice. Either load it from the CDN or from your own server, but not both places. I would recommend loading it from the CDN for now to avoid errors with file paths. 1 Link to comment Share on other sites More sharing options...
Mekaboo Posted September 9, 2021 Author Share Posted September 9, 2021 Sorry for the late repsonse...was feeling a tad under the weather. Thank ya so very much will make changes😊❤️ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now