gpt4 book ai didi

javascript - 成功后弹出消息窗口并禁用“提交”按钮

转载 作者:行者123 更新时间:2023-12-03 05:21:15 25 4
gpt4 key购买 nike

我有ajax函数,它将从servlet获取消息。当消息成功时,我想显示成功消息并禁用提交按钮,我该怎么做?请帮助我,非常感谢您的支持!

这是我的代码:

    <button id="send" onclick="ajaxSent()">SUBMIT</button>

function ajaxSent() {
$.ajax({
url:'/ApiSend.cfm',
data:{lname:l, pid:pid },
type:'get',
cache:false,
success:function(data){

if (data == null) {
alert("Try Again!");
}else if(data == 'success'){
alert("Transaction Sent Successfully...");
}
},
}
);
}

最佳答案

使用禁用属性。

success:function(data){
if (data == null) {
alert("Try Again!");
}else if(data == 'success'){
alert("Transaction Sent Successfully...");
$("#send").prop("disabled", true);
}

关于javascript - 成功后弹出消息窗口并禁用“提交”按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41372660/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com