jeudi 29 juin 2017

How to store all the input field value from datatable except for the field which is null?

$('form').on('submit', function(e){
    var form = this;
    // Encode a set of form elements from all pages as an array of names and values
    var params = table.$('input').serializeArray();
    // Iterate over all form elements
    $.each(params, function(){
        // If element doesn't exist in DOM
        if(!$.contains(document, form[this.name])){
            // Create a hidden element
            $(form).append(
                $('<input>')
                    .attr('type', 'hidden')
                    .attr('name', this.name)
                    .val(this.value)
            );
        }
    });
});

I am using this method to store all input field value from datatable, what if i just want to store only input field with value? Is that possible to do it? And after that in my controller, i want to loop the data and store in database.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2tqNTD1
via IFTTT

Aucun commentaire:

Enregistrer un commentaire