title: Track down why window.open does not work
body: <p>Other attempts to use <code>window.open('url', '_blank')</code> within this script work as desired. This one, not opening a new tab, uses different logic following a <code>confirm()</code> prompt. The logic is to display a portion of the page if 'Reserved' is found in it or to redirect to the target page otherwise.</p>
  
  <p>The redirect is automatic as a result of the <code>$.ajax</code> success handler. Neither method of redirect makes any changes. </p>
  
  <p>form for 2nd method:</p>
  
  <pre><code>&lt;form method=\"get\" id=\"formgoregistry\" name=\"goregistry\" action=\"\" target=\"_blank\"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>javascript function in question:</p>
  
  <pre><code>function getRegistryInfo(num) {
      // for 2nd method, set the form's action
      $('#formgoregistry').attr('action', 'http://somesite.com/somefile?n=somevalue');
  
      var response = $.ajax({
          type: 'POST',
          url: 'purchases_registry.php',
          dataType: 'html',
          data: { number: num },
          success: function(data) {
              console.log('response = '+data);
              if (data.indexOf('Reserved') &gt; 0) {
                  //  work with the result
                  //  Code in here works fine
                  ....
              }
              else {
                  // wrong data, redirect to outside page
                  //  **  Neither of these method open a new tab
                  // 1st method
                  var url = 'http://somesite.com/somefile?n=somevalue';
                  console.log('url = '+url);                // prints the correct url
                  var w = window.open(url, '_blank');       // NO new tab or error
                  console.log('window = '+w);               // window = undefined
  
                  // 2nd method (setting form's action beforehand)
                  console.log(document.goregistry.action);  // prints the correct url
                  document.goregistry.submit();             // NO new tab or error
              }
          }
      });
  }
  </code></pre>
  
  <p>I am wondering if the window being undefined is part of the problem and why.</p>