defined (‘ABSPATH’) false after AJAX post to other PHP-file

Follow these steps and you should be good to go:-

  1. Localize your script where you are implementing
    ajax(https://codex.wordpress.org/Function_Reference/wp_localize_script)
  2. Then make use of wp_ajax_{myfunction} (admin) and wp_ajax_nopriv_{myfunction}
  3. And lastly implement your code inside that function

    myfunction(){
        /****Your code goes here*****/
    }
    

    Eg. https://stackoverflow.com/questions/17855846/using-ajax-in-a-wordpress-plugin

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