title: Call ajax script in javascript with parameters to method in controller
body: <p>This is my head section with scripts</p>
  
  <pre><code>&lt;head&gt;
      @Scripts.Render("~/bundles/jquery")
      @Scripts.Render("~/bundles/jqueryval")
  
      &lt;script type="text/javascript"&gt;
          $(function () {
              $("#SelectHouse").click(function () {
                  var selected = $("#SelectedHouseDetailsId option:selected").text();
                  $("#SelectedHouseDetailsText").val(selected);
                  var idd = $("#Model.Reservation.Id").text();
  
              });    
          })
          $.ajax({
              url: "/ClientReservations/GetView",
              type: "GET",
              dataType: "html",
              data: {id: idd,name: selected}
          })
                  .success(function(result){
                      $('#divForSelectHouse').html(result)
                  })
          }
      &lt;/script&gt;   
  
      &lt;script type="text/javascript"&gt;
          function MyFunction() {
              var selected = $("#SelectedHouseDetailsId option:selected").text();
              $("#SelectedHouseDetailsText").val(selected);
          }
      &lt;/script&gt;
  
  &lt;/head&gt;
  </code></pre>
  
  <p>I would like to call method in controller in that way that after click button in form section</p>
  
  <pre><code>&lt;div class="form-group"&gt;
          @Html.Label("Domki", htmlAttributes: new { @class = "control-label col-md-2" })
          &lt;div class="col-md-10"&gt;
              @Html.DropDownListFor(model =&gt; model.SelectedHouseDetailsId, Model.Houses)
          &lt;/div&gt;
          &lt;div class="col-md-offset-2 col-md-10"&gt;
              &lt;input type="button" class="SelectHouse"
                     value="Wybierz domek" id="SelectHouse" /&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>I pass two parameters to following method</p>
  
  <pre><code>public ActionResult GetView(int id,string name)
          {
              ReservationHouseDetails houseDetails=null;
              repository.GetHousesForReservation(id).Where(item =&gt; item.Name.Equals(name)).ForEach(item =&gt; houseDetails = new ReservationHouseDetails()
              {
                  House=item,
                  Meal = repository.GetHouseMealForReservation(item.Id),
                  Participants = repository.GetParticipantsHouseForReservation(item.Id)
              });
  
              return PartialView("ReservationHouseDetails", houseDetails);
          }
  </code></pre>
  
  <p>Returned PartialView should be put into div section w view Details.cshtml</p>
  
  <pre><code>&lt;div id="divForSelectHouse"&gt;
  
  
      &lt;/div&gt;
  </code></pre>