I believe I have properly enqueue'ed and localized my script - I've got $q showing up in the DOM. Now I'm sure I'm missing the simple last step to accessing a variable in the JS function.
Here's my PHP:
add_action( 'wp_enqueue_scripts', 'sdm_load_javascript_files' );
function sdm_load_javascript_files() {
wp_register_script( 'showMake', get_template_directory_uri() . '/js/functions.js', array('jquery'), '1.1.0', true );
wp_enqueue_script( 'showMake', get_template_directory_uri().'/js/functions.js', array( 'jquery' ) );
$inventory_makes = get_inventory_makes();
wp_localize_script( 'showMake', 'q', $inventory_makes );
}
function get_inventory_makes() {
global $wpdb;
$inventory_makes = $wpdb->get_results
("
SELECT COUNT(inventory_id) as count_car, inventory_make
FROM wp_dsfbjd_wpinventory_item
GROUP BY inventory_make
");
return $inventory_makes;
}
And here's part of my template where I think I'm missing what I need:
<ul>
<?php
$inventory_makes = get_inventory_makes();
foreach ( $inventory_makes as $make )
{ echo '<li><a onclick="showMake(q.inventory_make)">',$make->inventory_make,' (',$make->count_car,')','</a></li>';
}
?>
</ul>
And lastly, my js function:
function showMake() {
console.log(q.inventory_make);
}
When I click on the HTML element, my console logs 'undefined' - after I've got access to the q.inventory_make I'll refresh the list of cars to show the make clicked.
Thanks in advance for pointing me in the right direction.

qlook like in the DOM? You iterate over it withforeachin PHP, accessinginventory_makeas a member of each$makeobject, but then in JS you try to accessinventory_makeas if it's a direct child ofq.