t4t5 / sweetalert

A beautiful replacement for JavaScript's "alert"
https://sweetalert.js.org
MIT License
22.4k stars 2.84k forks source link

Issue while calling a controller method #948

Closed sathwikkrishna closed 3 years ago

sathwikkrishna commented 3 years ago
sathwikkrishna commented 3 years ago

issue

on button click I'm calling a callresource function and then calling a controller method on show below, but facing an issue while calling as shown in above Screen shot.

`function callresource(Url, id, location, type) { swal("Do you want view?", { buttons: { Manually: { text: "Manually", value: "Manually", }, View: { text: "View", value: "View", } }, }) .then((value) => { switch (value) { case "Manually": swal("thanks"); break;

                    case "View":
                        swal("Are you sure?", {
                            buttons: {
                                Yes: {
                                    text: "Yes",
                                    value: "Yes",
                                },
                                No: {
                                    text: "No",
                                    value: "No",
                                }
                            },
                        })
                            .then((value) => {
                                switch (value) {
                                    case "Yes":
                                        Resize(Url, id, location, type);
                                        break;

                                    case "No":
                                        swal("Got away safely!");
                                        break;

                                    default:
                                        swal("Got away safely!");
                                }
                            });
                        break;

                    default:
                        swal("Got away safely!");
                }
            });
    }

function Resize(url,id, location, type) { var loc = url; $.ajax({ url: loc, //Your path should be here data: { id: resourceid, location: location, type: type }, type: "post", success: function (response) { location.reload(true); } }); } `