How to return Multiple Parameters using json in mvc4?
<p>Hi I have four fields in my view <code>CustomerName</code>, <code>ContactPerson</code>, <code>Email</code>, <code>MobileNo</code> </p>

<p><code>CustomerName</code> , <code>ContactPerson</code> are Cascading Dropdown and <code>Email</code> and <code>MobileNo</code> are textboxes. </p>

<p>If I select the <code>CustomerName</code> related <code>ContactPerson</code> will load automatically load in <code>ContactPerson</code> dropdown. </p>

<p>If i select the <code>Contactperson</code> the <code>ContactPerson</code> related <code>Email</code> and <code>PhoneNo</code> will load automatically in <code>Email</code> and <code>PhoneNo</code> textbox. I did this all task completely and all are working fine. Now what i need is i wish to reduce the code . </p>

<p><strong>My Controller Code</strong></p>

<pre><code>    public JsonResult GetCustomers()
     {
        return Json(db.Customers.ToList(), JsonRequestBehavior.AllowGet);
     }

    public JsonResult GetContactPersobByCustomerId(string customerId)
    {
        Guid Id = Guid.Parse(customerId);
        var customercontacts = (from a in db.CustomerContacts where a.CustomerID == Id select a);
        return Json(customercontacts, JsonRequestBehavior.AllowGet);
    }

  public JsonResult GetEmailByContactPersonID(Guid CustomerContactId)
     {
      var ContactID = db.CustomerContacts.Where(i =&gt; i.CustomerContactID == CustomerContactId).Select(i =&gt; i.ContactID).FirstOrDefault();
      var contact1 = (from p in db.Contacts where p.ContactID == ContactID select p).FirstOrDefault().Email1;
        if (contact1 == null)
        {
            var contact2 = (from a in db.Contacts where a.ContactID == ContactID select a).FirstOrDefault().Email2;
            contact1 = contact2;
        }
        return Json(contact1, JsonRequestBehavior.AllowGet);
     }

 public JsonResult GetPhoneNoByContactPersonID(Guid CustomerContactId)
    {
        var ContactID = db.CustomerContacts.Where(i =&gt; i.CustomerContactID == CustomerContactId).Select(i =&gt; i.ContactID).FirstOrDefault();
        var mobile1 = (from pn in db.Contacts where pn.ContactID == ContactID select pn).FirstOrDefault().Mobile1;
        if (mobile1 == null)
        {
            var mobile2 = (from a in db.Contacts where a.ContactID == ContactID select a).FirstOrDefault().Mobile2;

            mobile1 = mobile2;
        }
        return Json( mobile1, JsonRequestBehavior.AllowGet);
    }
</code></pre>

<p><strong>My View Code</strong></p>

<pre><code>   @Html.Label("Customer Name", new { @class = "control-label" })
   @Html.DropDownListFor(model =&gt; model.CustomerID, new SelectList(string.Empty, "Value", "Text"), "Please select a Customer", new { @class = "form-control required", type = "text" })

   @Html.Label("Contact Person", new { @class = "control-label" })
   @Html.DropDownListFor(model =&gt; model.CustomerContactID, new SelectList(string.Empty, "Value", "Text"), "Please select a ContactPerson", new { @class = "form-control", type = "text", id = "CustomerContactID" })

   @Html.LabelFor(model =&gt; model.MobileNo, new { @class = "control-label" })
   @Html.TextBoxFor(model =&gt; model.MobileNo, new { @class = "form-control", type = "text",disabled = "disabled", @readonly = "readonly"  })
   @Html.ValidationMessageFor(model =&gt; model.MobileNo)

    @Html.LabelFor(model =&gt; model.Email, new { @class = "control-label" })
    @Html.TextBoxFor(model =&gt; model.Email, new { @class = "form-control", type = "text" ,disabled = "disabled", @readonly = "readonly" })
    @Html.ValidationMessageFor(model =&gt; model.Email)
</code></pre>

<p><strong>My Json Code</strong></p>

<pre><code>    &lt;script src="~/Scripts/jquery-ui-1.11.0.js"&gt;&lt;/script&gt;
   &lt;script&gt;
        $(function () {
      $.ajax(
        '@Url.Action("GetCustomers", "VisitorsForm")',{
            type: "GET",
            datatype: "Json",
            success: function (data) {
                $.each(data, function (index, value) {
                    $('#CustomerID').append('&lt;option value="' + value.CustomerID + '"&gt;' + value.DisplayName + '&lt;/option&gt;');
                });
            }
        });

          $('#CustomerID').change(function () {
        $('#CustomerContactID').empty();

        $.ajax(
           '@Url.Action("GetContactPersobByCustomerId", "VisitorsForm")',{
                type: "POST",
                datatype: "Json",
                data: { CustomerID: $('#CustomerID').val() },
                success: function (data) {
            $('#CustomerContactID').append($('&lt;option&gt;&lt;/option&gt;').val('').text('Please select'));
                    $.each(data, function (index, value) {
                 $('#CustomerContactID').append('&lt;option value="' + value.CustomerContactID + '"&gt;' + value.ContactReference + '&lt;/option&gt;');
                   });
                  }
               });
            });
        });

  $("#CustomerContactID").change(function () {
           alert("hhh");
    $.ajax(
        '@Url.Action("GetEmailByContactPersonID", "VisitorsForm")',{
            type: "GET",
            dataType: "json",
            async: false,
            data: { CustomerContactID: $("#CustomerContactID").val()
            },
            error: function (ex) {
                alert('Failed to retrieve Email.' + ex);
            },
            beforeSend: function () {
            },
            success: function (data) {
                $("#Email").val(data);
                             }
                         });
                     });

   $("#CustomerContactID").change(function () {
     alert("hhh");
    $.ajax(
        '@Url.Action("GetPhoneNoByContactPersonID", "VisitorsForm")',{
            type: "GET",
            dataType: "json",
            async: false,
            data: { CustomerContactID: $("#CustomerContactID").val()
            },
            error: function (ex) {
                alert('Failed to retrieve Email.' + ex);
            },
            beforeSend: function () {
            },
            success: function (data) {

                $("#MobileNo").val(data);
            }
          });
        });
</code></pre>

<p>See my coding i wrote separate  json and jquery , ajax code for <code>Email</code> and <code>PhoneNo</code>. I feel it is not good . I wish to short my code. I want to pass multiple parameter using json. I want to pass the <code>Email</code> and <code>phone</code> while selecting the <code>ContatcPerson</code> in <code>ContactPerson</code> dropdown. it also effect  performance of my application. please any one give solution and suggestion for my problem. </p>

<p>Advance Thanks.. </p>