Welcome Guest, Not a member yet? Register   Sign In
One of my controllers refuses to load any views!
#17

[eluser]dauber[/eluser]
It only allows so many characters! But here's the controller as it exists now -- I want it to return the array to the AJAX call (URL helper is in autoload, btw):

Code:
<?php

class Srchgames_ctrl extends CI_Controller {
              
    function __construct() {
        parent::__construct();
        $this->load->library('form_validation');
        $this->load->database();
        $this->load->helper('form');
        $this->load->helper('email');
    }
    
    function do_search() {
        $this->load->model('srchgames_model');
        if ($_POST['a2600'] === 'true') {
            $search_games['console'][] = '2';
        }
        if ($_POST['a5200'] === 'true') {
            $search_games['console'][] = '5';
        }
        if ($_POST['a7800'] === 'true') {
            $search_games['console'][] = '7';
        }
        $search_games['manual'] = $_POST['manual'];
        $search_games['box'] = $_POST['box'];
        $search_games['notes'] = $_POST['notes'];
        $search_games['emanual'] = $_POST['manual'];
        $search_games['ebox'] = $_POST['box'];
        $search_games['enotes'] = $_POST['notes'];
        $search_games['include']['smanual'] = $_POST['manual'];
        $search_games['include']['sbox'] = $_POST['box'];
        $search_games['include']['snotes'] = $_POST['notes'];
        $search_games['search_terms'] = $_POST['search_terms'];
        $search_games['search_key'] = $_POST['search_key'];
        $search_games['rarity_fuzz_drop'] = $_POST['rarity_fuzz_drop'];
        $search_games['rarity_options'] = $_POST['rarity_options'];
        $search_games['aah'] = $_POST['aah'];
        $search_games['aar'] = $_POST['aar'];
        $search_games['aap'] = $_POST['aap'];
        $search_games['aau'] = $_POST['aau'];
        $search_games['include']['gamePlatform'] = $_POST['splatform'];
        $search_games['include']['atariagecom_rarity'] = $_POST['rarity'];
        $search_games['include']['cartColor'] = $_POST['cart_color'];
        $search_games['include']['labelCase'] = $_POST['label_case'];
        $search_games['include']['labelStyle'] = $_POST['label_style'];
        $search_games['include']['overlay'] = $_POST['overlay'];
        $search_result = $this->srchgames_model->search_games($search_games);
        return $search_result;
        error_log("If you can read this, it didn't return.");
    }
    
}

Here's the AJAX call:

Code:
function validate_list_form() {
    var errors = new Array();
    var form_data = new Array();
    if (($('#a2600').prop('checked') !== true) && ($('#a5200').prop('checked') !== true) && ($('#a7800').prop('checked') !== true)) {
        alert("You need to choose at least one console.");
        return false;
    } else {
        $.post('/index.php/srchgames_ctrl/do_search', {
            'a2600': $('#a2600').prop('checked'),
            'a5200': $('#a5200').prop('checked'),
            'a7800': $('#a7800').prop('checked'),
            'manual': $('#manual').prop('checked'),
            'box': $('#box').prop('checked'),
            'notes': $('#notes').prop('checked'),
            'emanual': $('#emanual').prop('checked'),
            'ebox': $('#ebox').prop('checked'),
            'enotes': $('#enotes').prop('checked'),
            'search_terms': $('#search_terms').val(),
            'search_key' : $('#search_key').val(),
            'rarity_fuzz_drop' : $('#rarity_fuzz_drop').val(),
            'rarity_options' : $('#rarity_options').val(),
            'aah': $('#aah').prop('checked'),
            'aar': $('#aar').prop('checked'),
            'aap': $('#aap').prop('checked'),
            'aau': $('#aau').prop('checked'),
            'splatform': $('#splatform').prop('checked'),
            'smanual': $('#smanual').prop('checked'),
            'sbox': $('#sbox').prop('checked'),
            'snotes': $('#snotes').prop('checked'),
            'rarity': $('#rarity').prop('checked'),
            'cart_color': $('#cart_color').prop('checked'),
            'label_style': $('#label_style').prop('checked'),
            'label_case': $('#label_case').prop('checked'),
            'overlay': $('#overlay').prop('checked')
        }, function(result) {
            console.log("Here's the result");
            console.dir(result);
        }).done(function() {
            console.log("DONE");
        });
    }
}


Messages In This Thread
One of my controllers refuses to load any views! - by El Forum - 08-07-2014, 11:05 AM
One of my controllers refuses to load any views! - by El Forum - 08-07-2014, 12:19 PM
One of my controllers refuses to load any views! - by El Forum - 08-07-2014, 01:38 PM
One of my controllers refuses to load any views! - by El Forum - 08-07-2014, 02:00 PM
One of my controllers refuses to load any views! - by El Forum - 08-07-2014, 02:21 PM
One of my controllers refuses to load any views! - by El Forum - 08-07-2014, 04:16 PM
One of my controllers refuses to load any views! - by El Forum - 08-07-2014, 04:42 PM
One of my controllers refuses to load any views! - by El Forum - 08-08-2014, 05:24 AM
One of my controllers refuses to load any views! - by El Forum - 08-08-2014, 11:20 AM
One of my controllers refuses to load any views! - by El Forum - 08-08-2014, 11:31 AM
One of my controllers refuses to load any views! - by El Forum - 08-08-2014, 11:51 AM
One of my controllers refuses to load any views! - by El Forum - 08-08-2014, 12:06 PM
One of my controllers refuses to load any views! - by El Forum - 08-08-2014, 09:26 PM
One of my controllers refuses to load any views! - by El Forum - 08-08-2014, 09:46 PM
One of my controllers refuses to load any views! - by El Forum - 08-08-2014, 09:53 PM
One of my controllers refuses to load any views! - by El Forum - 08-08-2014, 10:01 PM
One of my controllers refuses to load any views! - by El Forum - 08-08-2014, 10:07 PM
One of my controllers refuses to load any views! - by El Forum - 08-08-2014, 10:20 PM
One of my controllers refuses to load any views! - by El Forum - 08-08-2014, 10:24 PM
One of my controllers refuses to load any views! - by El Forum - 08-08-2014, 10:49 PM
One of my controllers refuses to load any views! - by El Forum - 08-08-2014, 10:50 PM
One of my controllers refuses to load any views! - by El Forum - 08-08-2014, 10:53 PM
One of my controllers refuses to load any views! - by El Forum - 08-08-2014, 11:10 PM
One of my controllers refuses to load any views! - by El Forum - 08-08-2014, 11:13 PM
One of my controllers refuses to load any views! - by El Forum - 08-09-2014, 06:04 AM
One of my controllers refuses to load any views! - by El Forum - 08-09-2014, 07:55 AM
One of my controllers refuses to load any views! - by El Forum - 08-09-2014, 10:00 AM
One of my controllers refuses to load any views! - by El Forum - 08-09-2014, 03:31 PM
One of my controllers refuses to load any views! - by El Forum - 09-02-2014, 04:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB