Passing Page ID used in Meta Box Creation to JavaScript

So, kind of a silly error on my part.

I needed to call my function from a place that had access to the variables I needed (such as the post ID). Using the following hook worked well:

add_action('the_post', 'add');