If you need to use the WordPress enviorment and functions in your ajax processing funciton then you need to post/get your AJAX request to admin-ajax.php, So change
'ajaxurl' => plugin_dir_url('my_plugin.php')
to
'ajaxurl' => admin_url('admin-ajax.php')