title: Open a popup box after receiving result from ajax
body: <p>i have a ajax code that works properly and gives the desired result. I want to modify this code and want that when a reply is received from ajax a popup/modal box should get opened. </p>
  
  <p>I am able to open popup/modal box on a click of a button</p>
  
  <pre><code>&lt;!-- Button trigger modal --&gt;
  &lt;button class="btn btn-primary" data-toggle="modal" data-target="#bsModal3"&gt;
      Small Modal
  &lt;/button&gt;
  
  &lt;!-- Modal --&gt;
  &lt;div class="modal fade" id="bsModal3" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true"&gt;
      &lt;div class="modal-dialog modal-sm"&gt;
          &lt;div class="modal-content"&gt;
              &lt;div class="modal-header"&gt;
                  &lt;button type="button" class="close" data-dismiss="modal" aria-hidden="true"&gt;&amp;times;&lt;/button&gt;
                  &lt;h4 class="modal-title" id="mySmallModalLabel"&gt;Modal title&lt;/h4&gt;
              &lt;/div&gt;
              &lt;div class="modal-body"&gt;
                  Your content goes here...
              &lt;/div&gt;
              &lt;div class="modal-footer"&gt;
                  &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Close&lt;/button&gt;
                  &lt;button type="button" class="btn btn-primary"&gt;Save changes&lt;/button&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>but don't know how to open it automatically within ajax.</p>
  
  <p>here is my ajax code</p>
  
  <pre><code>$.ajax({
      type: 'post',
      url: 'test2.php',
      dataType: 'json',
      data: {
          txt: txtbox,
          hidden: hiddenTxt
      },
      cache: false,
      success: function (returndata) {
          if (returndata[4] === 1) {
              // want to load a popup box here
          } else {
              // other code
          }
      },
      error: function () {
          console.error('Failed to process ajax !');
      }
  });
  </code></pre>
  
  <p>can anyone please tell me how it can be done</p>