好吧,我想在我的警報框中獲取jQuery變量值。我嘗試了一些東西,但是這並沒有像預期的那樣給出結果。如何在確認文本中使用jQuery變量值
$(document).ready(function() {
$("#submit").click(function() {
var dataString = {
amount: $("#amount").val()
};
var getamt = dataString.amount;
$.confirm({
title: 'Confirm!',
content: 'Are you sure you want to transfer $"'.getamt.'" to wallet?', // not getting the result
buttons: {
confirm: function() {
$.ajax({
type: "POST",
dataType : "json",
url: "add-funds-process.php",
data: dataString,
cache: true,
beforeSend: function(){
$("#submit").hide();
$("#loading-rent").show();
$(".message").hide();
},
success: function(json){
setTimeout(function(){
$(".message").html(json.status).fadeIn();
$('#wallet').html('$' + json.wallet);
$('#balance').html('$' + json.balance);
$("#submit").show();
$("#loading-rent").hide();
},1000);
}
});
},
cancel: function() {
$.alert('<span style="font-size: 23px">Upgrade Cancelled!</span>');
}
}
});
return false;
});
});
你們任何專家都可以幫助我嗎?我會很感激。
使用'+',而不是'.' ...和'VAR getamt = dataString.amt;'會拋出一個錯誤。 –
好像你正在嘗試使用php大聲笑。但是,是的,按照Kartikeya的說法。 –
謝謝..解決了這個問題:) –