Jquery: Return the value of a ajax call to caller function?
<p>Im trying to return the value that a $ajax call returns, from a function but it only returns "undefined". If a alert the "reponse" from the ajax call it returns the rigth value. Here is the code, what am i doing wrong?:</p>

<pre><code>$(".insertCandidate").live("click", (function(e) {
            var ids = this.id.toString().split("|");
            var tempCanID = ids[1];
            var canID = ids[0];
            var tempName = CandidateName(tempCanID);
            var canName = CandidateName(canID);
            //alert("HTML: "+tempName);
            $("#mergeCandidateDialog").empty();
            $.blockUI({ message: $("#mergeCandidateDialog").append(
                "&lt;div&gt;" + tempName + "s ansøgning til vil blive lagt under den eksiterende ansøger s data.&lt;br /&gt;&lt;br /&gt; Ønsker du at fortsætte?&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;" +
                "&lt;div id=\"content\"&gt;" +
                "&lt;input type=\"button\" id=\"" + ids + "\" class=\"insertCandidateYes\" value=\"Ja\" /&gt;" +
                "&lt;input type=\"button\" id=\"insertCandidateNo\" value=\"Nej\" /&gt;&lt;/div&gt;"), css: { cursor: 'default', fontWeight: 'normal', padding: '7px', textAlign: 'left' }
            });
        }));

function CandidateName(candidateID) {
        var returnstring;
        $.ajax({
            type: "POST",
            url: "/Admin/GetCandidateName/",
            data: { 'candidateID': candidateID },
            succes: function(response) {
                returnstring = response;
                return;
            },
            error: function(response) {
                alert("FEJL: " + response);
            }
        });

        return returnstring;
    }
</code></pre>
