vaishu
vaishu

Reputation: 1

how to fetch the input value entered using sweetalert?

using attribute ' type: "input" ', i am able enter value in textbox. I need to know how to fetch the input value . Below is my code :

input:"text" is not working ...I tried fetching value using json.parse ...nothing is working. Please help me to fetch and store the value

swal({ title: "Your order summary is ***", text: "Proceed to checkout", //type: "success", type: "input", showCancelButton: true, confirmButtonColor: "#EF5350", confirmButtonText: "Yes", cancelButtonText: "No", 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;

Upvotes: 0

Views: 372

Answers (1)

vaishu
vaishu

Reputation: 1

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

Upvotes: 0

Related Questions