file_get_contents returning different in filters and actions

If I understand you correctly, your dummy_data.json file is placed in the root directory of your page (the same directory where index.php and wp-config.php are placed), right?

In that case you can easily access that file passing this path: 'dummy_data.json' only when your code is run from index.php file.

But AJAX calls are fun from wp-admin/admin-ajax.php file. So when you try to open 'dummy_data.json' during ajax action, your code will try to open file called dummy_data.json placed in wp-admin directory – and there is no such file.

You can solve it by adding ABSPATH to the path:

get_file_contents( ABSPATH . '/dummy_data.json' );

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