sweetalert - 如何获取使用 sweetalert 输入的输入值?
问题描述
使用属性'类型:“输入”',我可以在文本框中输入值。我需要知道如何获取输入值。下面是我的代码:
输入:“文本”不起作用...我尝试使用 json.parse 获取值...没有任何效果。请帮我获取和存储价值
swal({ title: "Your order summary is ***", text: "Proceed to checkout", //type: "success", type: "input", showCancelButton: true, confirmButtonColor: "#EF5350", confirmButtonText: "是", cancelButtonText: "否", closeOnConfirm: false, showLoaderOnConfirm: false }, function(isConfirm){ if (isConfirm) { var gstva = jQuery.parseJSON(result); var dataString = {"pushCount":/ pushCount/0, "LECount":LECount,"gst": gstva}; $.ajax({ type:'POST', url: "store/requestPurchase", data: dataString, async: false, success: function(response){ var obj = jQuery.parseJSON(response); var response = obj.result ;
解决方案
swal({
title: "Your order summary is - <?php echo $price->country_detail; ?> - "+totalCost+"/- + Taxes",
text: "Proceed to checkout",
type : "input",
inputPlaceholder: "Enter your GST number(optional)",
showCancelButton: true,
confirmButtonText: "Yes",
closeOnConfirm: false,
},
function(inputValue,isConfirm){
if (((inputValue === "") || (inputValue !== "")) && (inputValue !== false)){
var dataString = {"pushCount":0, "LECount":LECount, "gstValue":inputValue};
推荐阅读
- python - 替换 for 循环以从具有多个列表的数据框中过滤值
- google-api - 使用静态响应测试 android 应用内购买时获取“无效值”
- php - 从php调用API时未传递JSON参数
- java - 将对象数组放入表中 - Java
- angular - 获取 json 集合数据到角度
- reactive-programming - 重试(或)重试时似乎不适用于热通量
- xaml - 如何在 UWP 的增量(惰性)加载 ListView 中实现 SearchBox 功能
- django - docker exec 看到本地文件的变化
- vba - 无法使用链接在电子表格中插入图片
- eclipse - 源文件夹未在 eclipse 中显示