Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Ajax send, change an option of current instance #216

Open
AbiruzzamanMolla opened this issue Oct 25, 2023 · 0 comments
Open

On Ajax send, change an option of current instance #216

AbiruzzamanMolla opened this issue Oct 25, 2023 · 0 comments

Comments

@AbiruzzamanMolla
Copy link

i am sending request via ajax. i would like to stop the closing timer when i click yes.

`
$('#translateAll').click(function() {
iziToast.question({
timeout: 20000,
close: false,
overlay: true,
displayMode: 'once',
id: 'question',
zindex: 999,
title: 'Hey',
message: 'This will take a while, are you sure?',
position: 'center',
buttons: [
['YES', function(instance, toast) {
var isDemo = "{{ env('PROJECT_MODE') }}";
var code = $('#translateAll').data('code');
var file = $('#translateAll').data('file');

                    if (isDemo == 0) {
                        toastr.error('This Is Demo Version. You Can Not Change Anything');
                        instance.hide({
                            transitionOut: 'fadeOut'
                        }, toast, 'button');
                        return;
                    }

                    $.ajax({
                        type: "post",
                        data: {
                            _token: '{{ csrf_token() }}',
                            code: code,
                            file: file,
                        },
                        url: "{{ route('admin.translateAll') }}",
                        beforeSend: function() {
                            toastr.success('starting');
                        },
                        success: function(response) {
                            if (response.success) {
                                instance.hide({
                                     transitionOut: 'fadeOut'
                                 }, toast, 'button');
                                 toastr.success(response.message);
                                 setTimeout(function() {
                                     window.location.reload();
                                 }, 2000);
                            }
                        },
                        error: function(err) {
                            toastr.error('Failed!')
                            console.log(err);
                            instance.hide({
                                transitionOut: 'fadeOut'
                            }, toast, 'button');
                        },
                    })

                }, true],
                ['<button>NO</button>', function(instance, toast) {

                    instance.hide({
                        transitionOut: 'fadeOut'
                    }, toast, 'button');

                }],
            ],
            onClosing: function(instance, toast, closedBy) {},
            onClosed: function(instance, toast, closedBy) {}
        });
    });`

inside beforeSend: function() { toastr.success('starting'); }, i want to do someting like instance.timeout: false

how can i do this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant