On my Web app, users can click a button to see their favorite places.  Underneath the list, there is button to enter additional favorites.  If they have on favorite, it works fine and I can see the list.  If I add a second favorite, it seems as if the AJAX does not execute at all. The click event works because I did console.log outside of ajax. But my list is empty!
I tried $('#favoritePlaces').click(function(e){ too but same result.
HTML and AJAX to view favorites:
<div id="homeMenu" hidden="hidden">
            <div class="pvBtn menuBtn" id="favoritePlaces">Favorite Places</div>
            <div class="pvBtn menuBtn" id="recentPaths">Recent Paths</div>
        </div>
        <div id="favoritesWrapper" hidden="hidden"> </div>
        <script>
            var favoritesArray = [];
            $(document).on('click', '#favoritePlaces', function(e){
                $.ajax({
                    url: 'https://pppp/accesspathweb/getfavorites.php',
                    type: 'POST',
                    dataType:"json",
                    data: {
                        acctid: localStorage.getItem('uacctid')
                    },
                    success: function(data){
                        var favoritesString;
                        if(JSON.stringify(data).includes('gf001')){
                            $('#myFavs').prepend('<h2>Enter Your Favorite Places To Quickly Access Them Later</h2>');
                        } else{
                            favoritesString = null;
                            var s = 0;
                            for(var f in data){
                                if(favoritesString == null){
                                    favoritesString = '<div class="favoritesList" id="favorites' + s + '">' + data.name + '</div>';
                                } else{
                                    favoritesString = favoritesString + '<div class="favoritesList" id="favorites' + s + '">' + data.name + '</div>';
                                }
                                favoritesArray.push(data.address);
                                s++;
                            }
                            $('#favoritesWrapper').html(favoritesString);                           document.getElementById('navigationWrapper').setAttribute('hidden', 'hidden');
        document.getElementById('favoritesWrapper').removeAttribute('hidden');
                        }               
                    },
                    error: function(errmsg){
                        console.log(errmsg);
                    },
                    cache: false
                });
                document.getElementById('homeMenu').setAttribute('hidden', 'hidden');
                //$('#myFavs').removeAttr('hidden');
                document.getElementById('myFavs').removeAttribute('hidden');
            });
</script>
Please let me know if you need more info. Thanks!
