当我确认提交值并获得成功警报时,我创建了一个输入框,但我在取消按钮上也获得了成功?
swal({
title: " Asking price for " + askData[0] + "?",
text: "If you are sure press OK or edit this text",
type: "input",
inputType: "text",
inputValue: "Hello " + askData[1] + ", I am interested in buying your " + askData[0] + " of Variety :" + askData[3] + ". Please update the Price!",
showCancelButton: true,
closeOnConfirm: false,
showLoaderOnConfirm: true
}, function (inputValue) {
if (inputValue === "") {
swal.showInputError("Please write something !");
return false;
}
$.ajax({
url: urlEnq,
type: "GET"
});
$.ajax({
url: 'saveUserMessage',
type: "POST",
data: {
fieldUserId: fieldUserId,
filedUserCompanyId: filedUserCompanyId,
message: inputValue
},
})
.done(function (data) {
swal("Done!", "Your message has been successfully sent.", "success");
})
.error(function (data) {
swal.showInputError("Please write something !");
});