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):

        var ConditionID = [];
        $('input[name^="ConditionID"]').each(function() {
        var Field = [];
        $('div[name^="Field"]').each(function() {
        var Status = [];
        $('select[name^="Status"]').each(function() { 
        var Description = [];
        $('textarea[name^="Description"]').each(function() {
            url: "/index.php/ConditionReports/saveCheckin",
            type: "POST",
            data: {'ConditionID':ConditionID,'Field':Field,'Status':Status,'Description':Description},
            error:function(jqXHR, textStatus) {
            alert( "Request failed: " + textStatus );

My view:

<form action='' method='post' id='checkin' accept-charset='ytf-8'>
    foreach($Conditions as $c) {
        <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[]'>");
            <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>
        <textarea class='form-control' name='Description[]' id='Description'>$c->Description</textarea>
<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>

My controller:

class ConditionReports extends CI_Controller
    public function __construct()
        $this->load->helper(array('form', 'url'));
        $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'),

And lastly my model:

public function UpdateReport($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!!"



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->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?