我禁用單擊按鈕時使用Ajax的網頁,並且還改變按鈕名稱。我現在正在將我的網站轉換爲一個應用程序,但似乎相同的代碼不適用於jquery mobile。Jquery - 禁用按鈕onsubmit並且還改變按鈕名稱
$(document).ready(function(){
$("form").on('submit',function(event){
event.preventDefault();
// Disable submit button on this specific form
$('.btn-style1', this).val('Inserted').prop('disabled', true);
data = $(this).serialize();
$.ajax({
type: "POST",
url: "new_user.asp",
data: data
}).success(function() {
$("input[type=text]").val("");
});
});
});
有幫助嗎?
你是如何將其轉換爲應用程序?什麼不工作?當在移動設備中調用代碼時,頁面'new_user.asp'很可能無法從那裏訪問。嘗試使用該文件所在網站/網址的路徑。 – Guillermo