mercredi 28 juin 2017

How can retain the value of button which been clicked for submit if there are 2 submit button?

There are two 'Submit' button and one of the button using preventdefault to perform checking and then unbind the submit and submit through the default event. It cannot detect which button been submitted.

I am using the statement below but it only works if there is one submit button. It will return blank page if there are two buttons.

$('form').unbind('submit').submit();

function.

{!! Form::open(['url' => '.....', 'id' => 'form']) !!}

    e.preventDefault();
                $.ajax({
                    type: 'GET',
                    url: 'check/'+'',
                    dataType: 'json',
                    success: function (data) {
                        if(data!=""){
                            swal({
                                ........
                            },function (isConfirm) {
                                if(isConfirm){
                                    $('form').unbind('submit').submit();

                                }
                            });
                        }
                        else{
                            $('form').unbind('submit').submit();
                        }
                    },
                    error: function (data) {
                        console.log('Error:', data);
                    }
                });



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire