title: Post data from MVC controller to view using ajax jquery
body: <p>I have a view which consist of a dropdown and some labels.
  Based on the selection of the value from the dropdown the relevant data needs to be populated on the labels.</p>
  
  <p>I have used ajax jquery for posting to the server based on dropdown selection but not able to fetch data as my httppost action method is already returning proper data but it is not caught in view.</p>
  
  <p>Dropdown javascript code</p>
  
  <p></p>
  
  <pre><code>   $(function () {
  
         $("#Year").change(function () {
             var Year = $('#Year').val();
             // var str = $(this).val();
             if (Year != "" || Year != "--Select--") {
                 //alert("hi");
                 $.ajax({
  
                     type: "POST",
                     url: '@Url.Action("Index", "TeamProbReview")',
                      data: { empcode: Year },
                      dataType: "json",
                      success:function(msg){ } }); 
  
                  //function successFunc(data, status) { $('#txtTradeQty').val(data); } //alert("success" + data + $('#txtTradeQty').val()); 
                  //function errorFunc() { alert('error'); } successFunc,  alert(data); 
              }
              else { alert("Pls Select a Employee"); }
  
         }); 
     });//end of doc ready
  
  &lt;/script&gt;
  </code></pre>
  
  <p>Controller code</p>
  
  <pre><code> public ActionResult Index(string empcode)
           {
              DropdownValue();
              data.spx_Probation_display_mvc(empcode);
              //TeamProbReviewModel tmProbRe = new TeamProbReviewModel();
              var emp = data.spx_Probation_display();
  
  
          var tmProbRe1 = (from e in emp
                                     select new TeamProbReviewModel
                                     {
  
                                         emp_name = e.emp_name,
                                         Ecode = e.emp_no,
                                         Department = e.Department
                                         //Role = e.FunctionalRole,
                                         //AttendanceLocation = e.attnlocation,
                                         //DateofJoining = e.JOINDATE,
                                         //ExpectedDOC = e.expected_doc,
  
                                         //ProbationPeriod = e.Probation_Period
  
  
                                     }).FirstOrDefault();
          //List&lt;TeamProbReviewModel&gt; ls = new List&lt;TeamProbReviewModel&gt;(EmpItems.ToList());
          //var emplist = (IEnumerable&lt;TeamProbReviewModel&gt;)ls;
          //ViewData["Person"] = new SelectList(iPersonList, "Id", "Name");
  
          //List&lt;Student1&gt; ls = data.spx_students(2, "vikas").ToList&lt;Student1&gt;();
  
  
  
  
          return View(tmProbRe1);
  
      }
  </code></pre>