Ajax call in custom action

We have created custom action in workflow. We need to call ajax on change event of dropdown. We put ajax function in customaction.js file.
jQuery.ajax({
type: ‘POST’,
url: ‘https://websitename/custom/Extension/application/Ext/Utils/functionaction.php’,
data: {
‘nounce’:‘ddd’,
‘site_id’:site_id,
‘action’: ‘customfunction’
},
success: function (data) {
console.log(data);

    },
    error: function (errorThrown) {
        console.log(errorThrown);
    }
});

customfunction is define in ‘https://websitename/custom/Extension/application/Ext/Utils/functionaction.php’, file.

It is not giving response from function. is there any step we need to follow for call ajax function ?
Kindly help us. We are stuck here.

Thanks in advance.

I’ve achieved this kind of things but calling the JS file inside detailviewdefs or editviewdefs like this

‘includes’ =>
array (
0 =>
array (
‘file’ => ‘custom/include/your_file.js’,
),
),

best regards