Q:

Calling javascript function from jquery with parameter

I am working on this code but even after consulting other threads I am not getting the result. It gives some error which causes Apache to throw exception. Here employee is retrieved from a link by $.getJSON(link, handler); and it passes data to handler function.
employeeNumber, fullName, gender  etc were pre-existing code and work correctly but when I try to calculate age by calling getAge function in jquery by passing birthDate as parameter, my application crashes. I have tested getAge function in a separate html page where I enter a date in format mm/dd/yyyy and it displays age correctly. 
function handler(employee) {
            $('#employeeNumber').val(employee.id);
            $('#fullName').val(employee.fullName);
            var bd = new Date(employee.birthDate);
            $('#dateOfBirth').val(bd.toDateString());
            $('#gender').val(employee.gender);
            $('#age').val(employee.birthDate, getAge);

        }

function getAge(dateString) {
        var today = new Date();
        var birthDate = new Date(dateString);
        var age = today.getFullYear() - birthDate.getFullYear();
        var m = today.getMonth() - birthDate.getMonth();
        if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {
            age--;
        }
        return age;
    }

This is a Java Spring application and I am using maven to compile war file.
Thanks and Regards

A:

I'm not sure what your trying to do in this line,
$('#age').val(employee.birthDate, getAge);

I've never seen syntax like that, but I think you where trying to do
$('#age').val(getAge(employee.birthDate));

