Calling javascript function from jquery with parameter
<p>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.</p>

<p>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. </p>

<pre><code>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 &lt; 0 || (m === 0 &amp;&amp; today.getDate() &lt; birthDate.getDate())) {
            age--;
        }
        return age;
    }
</code></pre>

<p>This is a Java Spring application and I am using maven to compile war file.</p>

<p>Thanks and Regards</p>
