Question Details

No question body available.

Tags

html ajax

Answers (1)

February 21, 2026 Score: 0 Rep: 81,185 Quality: Medium Completeness: 60%

The problem is that your

 Update

in the HTML does not really help you exactly evaluating it. To have an easy solution it makes sense to wrap an HTML element around it, like a span:

 Update

and then, in submitForm2 you can do this:

    function submitForm2() {        
        let form = $("#globalAdminUpdateDetails-form");
        let textElement = form.querySelector(".update-text");
        var data = form.serialize();
        $.ajax({                
            type : 'POST',
            url  : 'response.php?action=globalAdminUpdateDetails',
            data : data,
            beforeSend: function(){ 
                $("#error").fadeOut();
                textElement.innerText = "updating...";
            },
            success : function(response){           
                if($.trim(response) === "1"){
                    console.log('dddd');                                    
                    textElement.innerText = 'Details Updated';
                } 
                if($.trim(response) === "2"){
                    console.log('dddd');                                    
                    textElement.innerText = 'Account blocked...';
                }
                else {                                  
                    $("#error").fadeIn(1000, function(){                        
                        $("#error").html(response).show();
                    });
                }
            }
        });
        return false;                               
    }

Via wrapping an HTML element around the text you intend to change, it will be easy to change the inner text.