Script work on non logged in user but not work for logged in user?

i finally know why this code not work.
as menstioned by Jorn Lund in the comment that

jQuery(document).ready()

will fail when script loaded async ( i still dont know is my code load async) but with in mind i change from

jQuery(document).ready()

to self execution function

(function($){
    alert("hello");
})(jQuery);

and the code work very well on both loggedin and non loggedin user.

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