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 “https://techstew.tadabase.io/adding-referee/company/add-job/undefined” 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(){
    $('.submit-button').click(function(event){
        event.preventDefault();
        
        var recordId = $(this).parents('form').find('.recordId span').html();

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

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

Thank you in advance.