title: modal - passing parameter with url
body: <p>I am creating a modal in which I am passing a parameter that is supposed to open another view using a URL in script. However it opens a blank modal pop-up and never go to the URL. I have tried a couple of different ways however neither have worked.</p>
  
  <p>When I put <code>&lt;div class="modal-body"&gt;</code> in my modal code it will fill out the modal however I cannot get the parameter passed to it.</p>
  
  <p>My modal button - </p>
  
  <pre><code>  &lt;a href="#myModal" id="btnChange"class="btn btn-default" data-toggle="modal" data-id="@item.DeviceID"&gt;Change Location&lt;/a&gt;
  </code></pre>
  
  <p>My modal - </p>
  
  <pre><code>&lt;div id='myModal' class='modal fade' tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"&gt;
  &lt;div class="modal-dialog"&gt;
      &lt;div class="modal-content"&gt;
          &lt;div class="modal-body"&gt;
              &lt;div id='modal-content'&gt;
  
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>     </p>
  
  <p>Then my scripts - </p>
  
  <pre><code>$('#btnChange').click(function (eve) {
          var url = "/DeviceLocation/ChangeLocation/" + $(this).data("deviceID");
          $("#modal-content").load(url, function () {
              $("#myModal").modal("show");
          });
  
          //$("#modal-content").load("/DeviceLocation/ChangeLocation/" + $(this).data("deviceID"));
       })
  </code></pre>
  
  <p>I was requested to post my controller method - I have a <code>[HttpPost]</code> that I call when first accessing the view</p>
  
  <pre><code> [HttpGet]
      public ActionResult ChangeLocation(int deviceID)
      {
          PopulateLocation();
          ViewBag.DeviceID = deviceID;
          return View();
      }
  </code></pre>