如何获取使用sweetalert输入的输入值?

时间:2019-07-08 10:34:43

标签: sweetalert sweetalert2

使用属性'type:“ input”',我可以在文本框中输入值。我需要知道如何获取输入值。 下面是我的代码:

输入:“文本”不起作用...我尝试使用json.parse获取值...没有任何作用。请帮助我获取并存储值

swal({                     标题:“您的订单摘要为***”,                     文字:“继续结帐”,                     //类型:“成功”,                     类型:“输入”,                     showCancelButton:是,                     ConfirmButtonColor:“#EF5350”,                     ConfirmButtonText:“是”,                     cancelButtonText:“否”,                     closeOnConfirm:否,                     showLoaderOnConfirm:假                 },                 函数(isConfirm){                     如果(isConfirm){                         var gstva = jQuery.parseJSON(result);                         var dataString = {“” pushCount“:/ pushCount / 0,” LECount“:LECount,” gst“:gstva};                         $ .ajax({                             输入:“ POST”,                             url:“存储/请求购买”,                             数据:dataString,                             异步:错误,                             成功:功能(响应){                                 var obj = jQuery.parseJSON(response);                                 var response = obj.result;

1 个答案:

答案 0 :(得分:0)

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};