成功消息弹出窗口后,禁用“提交”按钮(After success message popup window and disable Submit button)

编程入门 行业动态 更新时间:2024-10-26 04:27:56
成功消息弹出窗口后,禁用“提交”按钮(After success message popup window and disable Submit button)

我有一个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..."); } }, } ); }

I have ajax function, which will get message from servlet. When message is success I want to show Success Message and Disable the submit button, how can I do it? Please help me, I really appreciate your support!

This is my code:

<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); }

Use disabled attribute.

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

更多推荐

本文发布于:2023-07-28 18:41:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1307970.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:弹出窗口   按钮   消息   success   message

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!