Custom taxonomy id not working with function.

I using AJAX to submit a form on a page that is a custom post type with a custom taxonomy. One of the values I want submitted is the custom taxonomy ID. I’m able to get this value in the code for the page itself. But for some reason, the function I created isn’t working.

Here are the basics of my function:

function myFunction(){

global $wpdb;

$something = stripslashes($_POST['something']);
$user_ID = get_current_user_id();
$terms = wp_get_object_terms( get_the_ID(), 'course_posts_category', array('fields'=>'ids'));
$module = $terms[0];

if($wpdb->insert(
'wp_lgc_notes',
array(
'user_id' => $user_ID,
'something' => $something,
'module' => $module
),
array(
'%d',
'%s',
'%d'
))===FALSE){

echo "Error";

}
else {
echo "Successfully added!";
}
die();
}
add_action('wp_ajax_myFunction', 'myFunction');
add_action('wp_ajax_nopriv_myFunction', 'myFunction');

Then the AJAX script:

jQuery('#myFunction').submit(ajaxSubmit);

function ajaxSubmit(){

var myFunction = jQuery(this).serialize();

jQuery.ajax({
type:"POST",
url: "/wp-admin/admin-ajax.php",
data: myFunction,
success:function(data){
jQuery("#feedback").html(data);
}
});

return false;
}

I hope that makes sense. Basically, the $module variable isn’t working, everything else is. I thought it had something to do with that the $module isn’t part of the form, but the $user_ID is working. Any ideas?