Using a var in .load()

Using a var in .load()

I'm looking to make a page that loads in data from various divs on a separate page depending on the hash part of the url.

If a page is loaded with the url of this will load info from an external  page  ( what-cms.php ) where the div has an id of #about

Below is how I think it might look, but I can not get it to work. Does anyone know a solution?

Also, can I put the hash variable in the .load () event to act as the div to load from the what-cms.php page?

  1. <body>
  2. <script type="text/javascript">

  3. $(window).load (function() {
  4. var hash = new String(window.location.hash);
  5. if ("hash:contains('#')")
  6.  {
  7.  $('#stuff').load('what-cms.php hash');
  8.  alert("you loaded" + hash);
  9.  }
  10.  else {
  11.   $('#stuff').load('what-cms.php #home');
  12.       alert("Nothing to load");
  13.  }});
  14. </script>
  15. <div id="stuff">Loading...</div>
  16. </body>