Codeignighter - Using jQuery to POST form data to my controller

So I am loading data into a form and the user should be able to change it and save it. The data loads fine and when the user clicks on the save button, jQuery grabs that data and should send it to my codeignighter controller, but it does not. The weird thing is that codeignighter is saying that the call was successful.

Here is my jQuery (it is in a seperate .js file):

$(document).ready(function(){
    $("#checkin").submit(function(e){
        e.preventDefault();
        var ConditionID = [];
        $('input[name^="ConditionID"]').each(function() {
            ConditionID.push($(this).val());
        });
        var Field = [];
        $('div[name^="Field"]').each(function() {
            Field.push($(this).val());
        });
        var Status = [];
        $('select[name^="Status"]').each(function() { 
            Status.push($(this).val());
        });
        var Description = [];
        $('textarea[name^="Description"]').each(function() {
            Description.push($(this).val());
        });
        $.ajax({
            url: "/index.php/ConditionReports/saveCheckin",
            type: "POST",
            data: {'ConditionID':ConditionID,'Field':Field,'Status':Status,'Description':Description},
            success:function(data)
            {
                alert('SUCCESS!!');
            },
            error:function(jqXHR, textStatus) {
            alert( "Request failed: " + textStatus );
            }
        });
    });
});

My view:

<form action='' method='post' id='checkin' accept-charset='ytf-8'>
    <?php
    $i=0;
    foreach($Conditions as $c) {
        echo("
        <input type='hidden' id='ConditionID' name='ConditionID[]' value='$c->ConditionID' />
        <div id='Field' name='Field[]' value='$c->Field'>$c->Field</div>
        <select id='Status' name='Status[]'>");
            $e=($c->Status=="E"?"selected":"");
            $g=($c->Status=="G"?"selected":"");
            $s=($c->Status=="S"?"selected":"");
            $b=($c->Status=="B"?"selected":"");
            $m=($c->Status=="M"?"selected":"");
            echo("
            <option $e value='E'>Excellent/New</option>
            <option $g value='G'>Good</option>
            <option $s value='S'>Satisfactory</option>
            <option $b value='B'>Poor/Needs Repair</option>
            <option $m value='M'>Missing</option>
        </select>
        <textarea class='form-control' name='Description[]' id='Description'>$c->Description</textarea>
        ");
        $i++;
    }
    ?>
<button type="button" class="btn btn-info">Print</button>
<input type="submit" id="saveCheckin" value='Save' class="btn btn-success save">
<button type="button" class="btn btn-success">Check-In</button>
</form>

My controller:

class ConditionReports extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->load->helper(array('form', 'url'));
        $this->load->model('ConditionReportsVM');
        $header_data['js'] = array('jquery-2.2.1.min','checkin');
        $this->load->view('header', $header_data);
    }
    public function saveCheckin()
    {
        $data = array(
            'ConditionID' => $this->input->post('ConditionID'),
            'Field' => $this->input->post('Field'),
            'Status' => $this->input->post('Status'),
            'Description' => $this->input->post('Description'),
        );
        $this->ConditionReportsVM->UpdateReport($data);
    }
}

And lastly my model:

public function UpdateReport($data)
{
    $this->db->where('ConditionID',$data['ConditionID']);
    $this->db->update('Conditions',$data);
}

I have been stuck on this for quite a bit of time now and any help I can get is most appreciated. I have debugged jQuery and found out that the appropriate data is being called. There are no console errors. I have tried to echo something from the controller and I have also tried to redirect the page from the controller but the controller just seems like it is not being hit.

Thank you in advance.

Note: Currently the response I get after I click save is an alert with this in it: "SUCCESS!!"

Answers


SOLUTION

Thanks to Goose (in the comments) I was able to find my issue. I did not know this, but you can see the response from the server if you go to the developer tools, and go to the Network tab. As soon as I went there I noticed that codeigniter was throwing an Array to string conversion error in my model.

Here is what my model looks like now (the data is saving and everything):

public function UpdateReport($data)
{
    for($i=0;$i<count($data['ConditionID']);$i++) {
        $this->db->where('ConditionID',$data['ConditionID'][$i]);
        $this->db->update('Conditions', array('Status' => $data['Status'][$i], 'Description' => $data['Description'][$i]));
    }
}

Need Your Help

What is the impact of compiling a program in 32 bits mode regarding optimizations

c gcc 64-bit

What are the differences in performance introduced when compiling an application in 32 bit mode on a 64 architecture?