AJAX Call in Plugin Returns More than JSON

Wrapping it in a function and then adding the following did the trick:

add_action( 'wp_footer', 'my_ajax_script' ); // Write our JS below here Was all it took

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)