Ajax return 0 in plugin – ajax only used in wp-admin

In the end i went ahead and changed all my code according to several examples i found across the web.

p.s
i came to the conclusion my code is ok but isnt suitable for the accepted structered that needs to be used for ajax inside wp-admin.

In any case…
Here is a version that works. in the hope this might helps someone

The JS

jQuery(document).ready(function($) {

    $('#sgxcsParentTax').change(function() {

        var selected    =   $(this).val();

        data = {
            action: 'sgxcs_get_childcats',
            selected: selected
        }

        $.post(ajaxurl, data, function (response) {
            var $response       = $(response);
            var childcats       = $response.filter('#childcats').html();

            // HANDLE SUCCESS >>
            if(childcats) {
                $('#sgxcsChildTax').html(childcats);
            }           
        });

    });

});

The Php…

function get_childcats_ajax(){

    echo 'I AM WORKING! (finally)'; 

    die();
}
add_action('wp_ajax_sgxcs_get_childcats', 'get_childcats_ajax');