title: How to delete item form list without using a delete dialog mvc C#
body: <p>I am working on an MVC C# application and I have something similar to a "cart". 
  Following in the steps of Amazon, I want the user to have the ability to delete an item but with NO pop up dialog.</p>
  
  <p>This is my view button</p>
  
  <pre><code>            &lt;button class="btn btn-danger feather icon-trash-2" onclick="delItem('@item.transactionId')" data-toggle="tooltip" title="Delete"&gt;&lt;/button&gt;
  </code></pre>
  
  <p>and below is my function in script</p>
  
  <pre><code>function delItem(transID) {
      $.ajax({
          type: "POST",
          url: '@Url.Action("Delete", "Services")',
          data: transID,
          cache: false,
          dataType: 'json',
  
      });
  }
  </code></pre>
  
  <p>The idea is that is goes to the postMethod and performs the delete. However I am getting a "500 internal server error"</p>
  
  <pre><code>vendor-all.min.js:3 POST http://localhost:58004/Services/Delete 500 (Internal Server Error)
  </code></pre>
  
  <p>Grateful for any assistance.</p>
  
  <p>Regards</p>
  
  <p>Controller Delete Code</p>
  
  <pre><code>public ActionResult Delete(Guid? id)
  {
      if (id == null)
      {
          return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
      }
      Transaction transaction = db.Transactions.Find(id);
      if (transaction == null)
      {
          return HttpNotFound();
      }
      return View(transaction);
  }
  
  // POST: Transactions/Delete/5
  [HttpPost, ActionName("Delete")]
  [ValidateAntiForgeryToken]
  public ActionResult DeleteConfirmed(Guid id)
  {
      Transaction transaction = db.Transactions.Find(id);
      db.Transactions.Remove(transaction);
      db.SaveChanges();
  
      return RedirectToAction("Index");
  }
  </code></pre>