wp_ajax action is not run when ajax trigger

I’ve tested your code and it works perfectly. I’ve just declared the dependencies for the JavaScript, so it is loaded correctly after jQuery. This is how I’ve tested it:

functions.php

function my_resource() {
    wp_enqueue_script('my-jquery',get_template_directory_uri().'/jqfunctions.js', array('jquery'));
    wp_localize_script( 'my-jquery', 'myback', 
    array('ajax_url' => admin_url( 'admin-ajax.php' )));
}
add_action('wp_enqueue_scripts', 'my_resource');
function getsomething(){
  wp_send_json_error('hey');
}
add_action('wp_ajax_nopriv_getsomething', 'getsomething');
add_action('wp_ajax_getsomething', 'getsomething');

jqfunctions.js

jQuery(document).ready(function(){
jQuery("#popular").click(function(e){
    e.preventDefault();
    console.log('popular clicked');
    jQuery.ajax({
        url: myback.ajax_url,
        type: 'POST',
        dataType: 'json',
        data:{
            action: 'getsomething'
        },
        success: function( response ){
            console.log("This is response...");
            console.log(response);
        },
        error: function( error ){
            console.log('AJAX error callback....');
            console.log(error);
        }
       });
    });
});