title: Loading data in a Kendo Window with AJAX when a link is clicked
body: <p>I have an mvc razor page that has several product items listed on it using a razor foreach loop:</p>
  
  <pre><code>@foreach (var product in Model)
  {
      &lt;h2&gt;@product.Title&lt;/h2&gt;
      &lt;div&gt;product.Description&lt;/div&gt;
  
      &lt;a href="#" class="lnkViewRatings"&gt;View Reviews&lt;/a&gt;
  }
  </code></pre>
  
  <p><strong>My goal:</strong>
  On the click of any link with the css class 'lnkViewReviews' on it I would like the kendo window to open and display a listing of all of the Reviews for that product using an ajax request. The request will be of type GET and depending on the product where the link was clicked the data param will be the productId.</p>
  
  <p>Here is exactly that I would like (please tell me if there is a better way to do it also):</p>
  
  <ol>
  <li>User clicks View Reviews link by one of the listed products.</li>
  <li>A dialog window opens up and pulls in the list of that products reviews in some sort of template that I can specify.</li>
  </ol>
  
  <p>Below is my attempt based on the kendo documentation, but I am having problems. Can you please show me a good way to achieve this?</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;div id="dialog"&gt;
      &lt;p&gt;This is static text in my dialog window&lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>JavaScript</p>
  
  <pre><code>$("#dialog").kendoWindow({
      visible: false
  });
  var dialog = $("#dialog").data("kendoWindow");
  
  $(".lnkViewReviews").click(function (e) {
      e.preventDefault();
  
      dialog.refresh({
          url: "/Products/GetReviews",
          data: { productId: $(this).attr('data-product-Id') },
      });
  
      dialog.open().center();
  });
  </code></pre>
  
  <p><strong>The asp.net MVC controller action method:</strong></p>
  
  <pre><code>public IActionResult GetReviews(int productId)
  {
      var prodReviews = _repository.GetProductReviews(productId);
  
      return Json(prodReviews);
  }
  </code></pre>