Wp_query returning only one post while query through ajax

You are resetting the $output value in the loop. Declare an empty variable first, and then append each result to it in the loop:

  if($posts->have_posts()){
    $output="";
    while ($posts->have_posts()) {
      $posts->the_post();
        $output .= get_the_title();
    }
  }

This will add all the posts to the $output variable.

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