How to make my defer to work
<p>Need some helpt with my defer, tried to use .then and .done. But it doesnt work.
It write my console.log before my servercall is done.</p>

<pre><code>$.when(PersonAtlLawUpdate(personRef)).then(console.log('test'));

function PersonAtlLawUpdate(personRef, cbFunc) {
    var selectionPanel = $('div#SelectionPanel'),
        fromdate = selectionPanel.find('input#FromDateTextBox')[0].defaultValue,
        timeSpan = selectionPanel.find('select#TimeSpanDropdownList').data('timespanvalue'),
        url = "MonthOverview.aspx/OnePersonAtlLawUpdate";
    $.ajax({
        url: url,
        data: JSON.stringify({ personRef: personRef, fromdate: fromdate, timespan: timeSpan }),
        type: "POST",
        contentType: "application/json",
        dataType: "JSON",
        context: document.body,
        success: function (atlError) {
            changePersonAtlStatusIcon(atlError, personRef);
            if (cbFunc != null) {
                cbFunc();
            }
            return atlError;
        },
        error: function (xhr, status, errorThrown) {
            //alert(errorThrown + '\n' + status + '\n' + xhr.statusText);
        }
    });
}
</code></pre>
