    $( document ).ready( function() {
        // Delegate the click event to any anchor inside our load-more block.
        $( document ).on( 'click', '.is-load-more', function( e ) {
            e.preventDefault();
          //  alert();

            var $button = $( this );
            var nextPageUrl = $button.attr( 'href' );
            var target = $button.closest( '.wp-block-query ' ).attr('id');


            if ( ! nextPageUrl ) {
                return;
            }

            // Optionally update the button text or add a loading indicator.
            $button.text( 'Loading...' );

            // Make an AJAX GET request to fetch the next page.
            $.ajax({
                url: nextPageUrl,
                method: 'GET'
            }).done( function( data ) {
                // In this basic example we assume that the AJAX response
                // returns HTML containing your posts wrapped with the class ".wp-block-post".
                var parsed = $.parseHTML( data );
                var $data = $( parsed );
                var $posts = $data.find( '#'+target+' ul .wp-block-post' );
console.log( target);
                if ( $posts.length ) {
                    // Append the new posts to your query container.
                    // (Adjust the selector to target your query loop container as needed.)
                    $( '#'+target+' ul' ).append( $posts );

                    // Find the new "next page" link in the returned HTML.
                    var newLink = $data.find( '.is-load-more' ).attr( 'href' );
                    if ( newLink ) {
                        // Update the button’s link and restore its text.
                        $button.attr( 'href', newLink ).text( 'Load More' );
                    } else {
                        // No new link? Remove the load more button.
                        $button.closest( '.is-load-more' ).remove();
                    }
                } else {
                    // No posts found: remove the button.
                    $button.closest( '.is-load-more' ).remove();
                }
            }).fail( function() {
                // On error, reset the button text.
                $button.text( 'Load More' );
            });
        });
    });