ARTICLE AD BOX
The problem is that your
<span class="spinner"><i class="icon-spin icon-refresh" id="spinner"></i></span> Updatein 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:
<span class="spinner"><i class="icon-spin icon-refresh" id="spinner"></i></span> <span class="update-text">Update</span>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.
23k6 gold badges28 silver badges46 bronze badges
81.2k42 gold badges124 silver badges236 bronze badges
Explore related questions
See similar questions with these tags.

