Redirect to another Page under the same parent record

Hi Tadabase,

I found this topic Add redirects to action link options, this is the closest I can get to what my goal is.

My goal is that, whenever I click the submit button on the form under a parent record, I would like to redirect me to another page that is also under the same parent record. I do some editing from the code provided. I convert the code from action link, it works, it brings me to another page. However, it is not the correct page. Instead of record ID of the parent record it was “” there is a word undefine. I paste the code below if anyone wants to help me please. What should I do? Please help/ Thank you.

var setOnClickEventsForSubmitButton = function(){
        var recordId = $(this).parents('form').find('.recordId span').html();

        window.location.href = "/adding-referee/company/add-job/"+recordId;

TB.render('component_6', function(data) {
    $('body').on('submit', '#recordForm', function(){
        }, 800);

Thank you in advance.