Standard technique for AJAX post endpoint: WP REST or WP API?

You can use wp_ajax action:

add_action( 'wp_ajax_my_awesome_ajax', 'my_awesome_func' );
add_action( 'wp_ajax_nopriv_my_awesome_ajax', 'my_awesome_func' );

function my_awesome_func() {
  // Handle request with $_POST

  wp_die();
}

You can submit contact form with jQuery post:

jQuery.post(
  my_awesome_js.ajaxurl, 
  {
    'action': 'my_awesome_ajax',
    'data': 'some data'
  },
  function(response){
    alert(response);
  }
);

The my_awesome_js.ajaxurl you use wp_localize_script:

wp_enqueue_script('my_awesome_js', '/path/to/your/script/above.js', array('jquery'));
wp_localize_script('my_awesome_js', 'my_awesome_js', array(
   'ajaxurl' => admin_url('admin-ajax.php')
));

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