How To Pass Ajax Value to PHP Query?

Create simple functions like

function func_for_ajax(){
    wp_localize_script( 'ajax_custom_script', 'frontendajax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' )));
    echo "simple demo ajax";

}

Than create your ajax pass in wordpress action threw this function name directly.

jQuery.ajax({
     type: "POST",
     action: 'func_for_ajax',
     url: 'ajaxurl',
     success: function(data){
       jQuery('#content2').html(data);
     }

});

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