AJAX call from keydown on one text box to populate another text box ASP.NET MVC
<p>I am attempting to populate a textbox from the value in a separate textbox, ie. using the customer account number to auto-populate the customer name. My AJAX is returning the proper results, however it's not getting populated into the other textbox, which is why I suspect my jQuery is wrong.</p>

<pre><code>&lt;div class="form-group"&gt;
    @Html.LabelFor(model =&gt; model.AccountNumber, htmlAttributes: new { @class = "control-label col-md-2" })
    &lt;div class="col-md-10"&gt;
        @Html.TextBoxFor(model =&gt; model.AccountNumber, new { @class = "form-control" })
        @Html.ValidationMessageFor(model =&gt; model.AccountNumber, "", new { @class = "text-danger" })
    &lt;/div&gt;
&lt;/div&gt;

&lt;div class="form-group"&gt;
    @Html.LabelFor(model =&gt; model.CustomerName, htmlAttributes: new { @class = "control-label col-md-2" })
    &lt;div class="col-md-10"&gt;
        @Html.TextBoxFor(model =&gt; model.CustomerName, new { @class = "form-control" })
        @Html.ValidationMessageFor(model =&gt; model.CustomerName, "", new { @class = "text-danger" })
    &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<pre class="lang-csharp prettyprint-override"><code>[HttpGet]
public ActionResult GetCustomerName(string RecKey)
{
    var result = (from c in db.Customers
                    where c.RecKey.Equals(RecKey)
                    select new { c.RecName });
    return Json(result, JsonRequestBehavior.AllowGet);
}
</code></pre>

<p>Returned JSON (only returning one result that's an exact match):</p>

<pre><code>[{"RecName":"This is a customer name"}]
</code></pre>

<pre class="lang-js prettyprint-override"><code>$(document).ready(function () {
    var RecKey;
    $(function () {
        $("#AccountNumber").keydown(function () {
            RecKey = $("#AccountNumber").val();
            $.ajax({
                type: "GET",
                url: 'GetCustomerName',
                data: { RecKey: RecKey },
                success: function (data) {
                    if (data) {
                        //alert(data);
                        $('#CustomerName').val(data.RecName);
                    }
                }
            });
        });
    });
});
</code></pre>

<p>I am rather new to jQuery and have had success with autocomplete on the same textbox, however my searching hasn't found much for me to populate other text boxes. Anyone have any ideas?</p>