Load to no, that is, the final display is gone, you can also click on it, and continue to display loading-style text, how to solve the problem

/ / Page load
jQuery (document) .ready (function ($) {

    var loading=false
    $("div-sharppost-read-more a").click( function() {
        if(loading)return
        loading=true
        $this = $(this);
        $this.addClass("loading").text("Loading"); //aloadingclass
        var href = $this.attr("href"); //
        if (href != undefined) { //
            $.ajax( { //ajax
                url: href, //
                type: "get", //get
                error: function(request) {
                    loading=false
                },
                success: function(data) { //
                    loading=false
                    $this.removeClass("loading").text(""); //loading
                    var $res = $(data).find(".list"); //
                    $(".box").append($res); //posts-loop
                    var newhref = $(data).find("-sharppost-read-more a").attr("href"); //
                    if( newhref != undefined ){
                        $("-sharppost-read-more a").attr("href",newhref);
                        
                    }else{
                    
                        $("-sharppost-read-more a").html("").removeAttr("href");
                        
                        
                    }
                }
    });   
}   
return false;   

});

});
loaded to no, that is, the final display is gone, you can click on it, and continue to display loading-style text. How to solve it? how to modify

?
Apr.25,2021

put loading=true,$this.addClass ('loading'). Text ("Loading"); after if (href! = undefined)

 $('div-sharppost-read-more a').click( function() {
        if(loading)return
        $this = $(this);
        var href = $this.attr("href"); //
        if (href != undefined) { //
            loading=true
            $this.addClass('loading').text("Loading"); //aloadingclass
            $.ajax( { //ajax

PS: I think it is not more appropriate to use button in your example. Using data-url to save the address of the next page, you use the a tag to feel that you want to save a url, to prevent the default jump event and to control whether it can be clicked. By contrast, button is much more suitable. When "gone", set button to disabled,data-url to save the address of the next page, properly, without ambiguity

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b369ff-2b577.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b369ff-2b577.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?