How to pass the API key to the client from the database? [closed]

Assuming you are using wp_enqueue_script to load the .js, then use wp_localize_script to set the value of your key.

Another option is to use wp_add_inline_script instead of wp_localize_script.

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