title: Confirmation Dialog with Bootstrap/jQuery/ASP.MVC
body: <p>I have a simple table with records and each of them has a btn with data-id attribute to run the confirmation dialog:</p>
  
  <pre><code>@foreach (var dog in Model)
          {
              &lt;tr&gt;
                  &lt;td&gt;@dog.Name&lt;/td&gt;
                  &lt;td&gt;@dog.Age&lt;/td&gt;
                  &lt;td&gt;&lt;a href="#" data-id="@dog.Id" class="btn btn-danger deleteBtn"&gt;Delete&lt;/a&gt;&lt;/td&gt;
              &lt;/tr&gt;
          }
  </code></pre>
  
  <p>After clicking the delete btn, this code is running :</p>
  
  <pre><code>$('.deleteBtn').on('click', function () {
              $.ajax({
                  url: '@Url.Action("DeleteConfirm", "Home")',
                  data: {
                      id : $(this).attr('data-id')
                  },
                  success: function(data)
                  {
                      $('#myModal').empty().html(data).modal('show');
                  }
              });
          });
  </code></pre>
  
  <p>As you can see, its Ajax request to my Action in HomeController. It returns PartialView that is loaded to my Bootstrap dialog:</p>
  
  <pre><code>&lt;div class="modal fade" id="myModal"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>After showing the dialog, the user can click confirm to delete the row via button with class saveBtn. Thats what happens after I click it :</p>
  
  <pre><code>$('#myModal').on('click', '.saveBtn', function () {
              var numer = $(this).attr('data-id');
  
              $.ajax({
                  url: '@Url.Action("DeleteDog", "Home")',
                  type: 'POST',
                  dataType: 'JSON',
                  data: {
                      id: numer
                  },
                  success: function (data)
                  {
                      if (data = 'true')
                          $('a[data-id=' + numer + ']').closest('tr').remove();
                  }
              });
          });
  </code></pre>
  
  <p>So as you can see there is another Ajax (POST this time) request to delete the row. </p>
  
  <p>So here is my question. Is this approach good practice? I'm not sure because in order to delete a row i have to send 2 ajax request (to load confirm dialog, and delete after confirm). Can anyone experience developer comment this code and say whether im doing it good or bad? I would be grateful.</p>