Last active
October 13, 2017 11:53
-
-
Save Nick0603/cc523af622c6e98e0a58ffe767276508 to your computer and use it in GitHub Desktop.
update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
swal({ | |
title: '更新資料', | |
html: | |
'名字:'+ | |
'<input id="swal-input1" class="swal2-input" >' + | |
'年齡:'+ | |
'<input id="swal-input2" class="swal2-input" >' | |
, | |
preConfirm: function () { | |
return new Promise(function (resolve) { | |
resolve([ | |
$('#swal-input1').val(), | |
$('#swal-input2').val() | |
]) | |
}) | |
} | |
}).then(function (result) { | |
// 按下確認後執行的程式。起頭 | |
swal( | |
'更新!', | |
'此學生資料已經成功更新.', | |
'success' | |
) | |
var newData = { | |
name: result[0], | |
age:result[1] | |
}; | |
console.log(newData); | |
// 按下確認後執行的程式。截止 | |
}).catch(swal.noop); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment