Skip to content

Instantly share code, notes, and snippets.

@Nick0603
Last active October 13, 2017 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nick0603/cc523af622c6e98e0a58ffe767276508 to your computer and use it in GitHub Desktop.
Save Nick0603/cc523af622c6e98e0a58ffe767276508 to your computer and use it in GitHub Desktop.
update
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