title: How to tell if a page is being called via Ajax, or on it's own
body: <p>I have a page that loads other pages via Ajax (think frames, except without the frames).  </p>
  
  <p>Obviously these pages can all be called independently, so I want to detect if they are being called via the Ajax, and if not, redirect to the main Ajax page.</p>
  
  <p>The pages are php pages, so I have access to that as well.</p>
  
  <p>index:</p>
  
  <pre><code>    goto = "StandalonePrograms.php";
      var clear = "&lt;br style='clear:both;'&gt;"
      if(goto != ''){
          $.ajax({
              url: goto,
              context: document.body,
              success: function(data){
                  $('#mainwindow').html(data + clear);
                  $('#mainwindow').find("script").each(function(i){
                      eval($(this).text());
                  });
              }
          });
      }
  </code></pre>