title: How do I add a confirmation popup on a button (GET POST action in MVC)?
body: <p>I have a get/post/JSON function on an aspx page.  This page adds data entered in a textbox to a table populated by javascript.  When the user select the submit button.  If the textbox is not empty, have a popup button telling the user the data in the textbox is not saved in the table. How do I have a confirm "ok/cancel" popup display on the post action in the Controller? 
  I made a quick summary of what my code looks like.</p>
  
  <pre><code>...
  &lt;%  using (Html.BeginForm("AddName", "Name", FormMethod.Post, new { id = "AddNameForm" })) { %&gt;
  ...
  &lt;table id="displayNameTable" width= "100%"&gt;                        
      &lt;tr&gt;
          &lt;th colspan="3"&gt;Names Already Added&lt;/th&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td style="font-size:smaller;" class="name"&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;  
  ...
  &lt;input name="Name" id="txtInjuryName" type="text" value="&lt;%=test.Name %&gt;" /&gt;
  ...
  &lt;input type="submit" name="add" value="Add"/&gt;
  &lt;% } %&gt;
  &lt;form id="form1" runat="server"&gt;
             string confirmNext = "";
      if (test.Name == "")
      {
         confirmNext = "return confirm('It seems you have a name not added.\n\nAre Continue?')";
      }%&gt;
      &lt;input type="submit" name="getNext" value="Next" onclick="&lt;%=confirmNext%&gt;" /&gt;
  &lt;/form&gt;
  </code></pre>