Woocommerce Ajax Add cart not working

I think your php add_to_cart function not setting cart cookies, you can do this manually by adding this line inside the if condition before

//$added 

line

add this line

do_action( 'woocommerce_set_cart_cookies', TRUE );

this will set cart cookies.

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