title: SetInterval and SetTimeout not working when trying to load a Partial View
body: <p>I'm trying to use <code>JQuery</code> to reload a <code>PartialView</code> in an <code>ASP.Net MVC</code>  application.</p>
  
  <p>My code:</p>
  
  <pre><code>&lt;div class="partial"&gt;
       @Html.Action("GetRemainingSeats", "Layout")
  &lt;/div&gt;
  &lt;script src="@Url.Content("~/Scripts/jquery-1.10.2.min.js")"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
              setTimeout(
              $(function () {
                  setInterval(function () { $('#partial').load('@Html.Action("GetRemainingSeats", "Layout")'); }, 5000)
              }), 6000);
  &lt;/script&gt;
  </code></pre>
  
  <p>The partial view is loaded correctly, but immediately after that, it will again execute the action, without waiting for the <code>setTimeout</code> function timer to elapse. After that it will stop doing anything.</p>
  
  <p><strong>Edit:</strong>
  Inside the <code>PartialView</code> there is a table with shows in a cinema together with how many seats are left for each show. So I want that to update very couple of seconds so the employees can see how many seats are left for a show.</p>
  
  <p>I'm using the timeout and <code>setinterval</code> function because on <code>pageload</code> the action is called. After that I want it to wait a couple of seconds before starting the interval</p>