How to not do anything after until an OK button is clicked in javascript?
<p>I have an $.ajax() function that requests something with a string location. </p>

<p>Assume result.location = "Somewhere" on the ajax response, but theoretically it could be any string.</p>

<p>On success(result) it does:</p>

<pre><code>Line 1: alert("Hello There");
Line 2: alert("Look Here" + result.location); // Look here Somewhere
</code></pre>

<p>What happens is an alert box for "Hello There" pops up and "Look here" alert box is not shown until AFTER the user closes the "Hello There" alert box.</p>

<p>However, if for Line 1 instead of an alert I have a div instead of an alert box that shows up for example:</p>

<pre><code>&lt;div&gt;Hello There &lt;input type="button"&gt;OK&lt;/input&gt;&lt;/div&gt;
</code></pre>

<p>So instead I have:</p>

<pre><code>Line 1: showDivAlert();
Line 2: alert("Look Here" + result.location); // Look here Somewhere
</code></pre>

<p>Then what happens is the div shows up and the alert "Look Here" pops up. What could I put in function "showDivAlert()" such that any code below showDivAlert() will not get executed until the user clicks the "OK" button?</p>

<p>NOTE: key here is to preserve the result.location string of the ajax request</p>
