0

this is simplified code of my problem,

the form contains n dynamic inputs. the form data posted by ajax using serializeArray() method. so i wanted to do is, get those data array and batch insert to database. thanks you.

HTML

<form id='testsales'>
<input type="text" id="item" name="item[]">
<input type="text" id="description" name="description[]">
<form>

JQuery Ajax

var formData = $('#testsales').serializeArray();
        var base_url = $('#hidden_base_url').val();
        var dataSentUrl = base_url+'index.php/frontend/testsales';
        jQuery.ajax({
            type        : 'POST',
            url         : dataSentUrl,
            dataType    : 'json',
            data        : formData,
            success     : function (responce){
                console.log(responce);
               }
        });

CI_Controller

function testsales(){
        // Get jquery posted data and insert_batch to database

    }
Ranath CS
  • 29
  • 7

0 Answers0