成功消息弹出窗口后,禁用“提交”按钮(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); }更多推荐
发布评论