.load() with VAR not working! PLEASE HELP!
Please can someone help with this simple problem!
In this example, only the contents of a div called #business-services-info should be loaded in from the what-cms.php page, not the full page.
Can anyone explain why the .load() event is ignoring my var (ahash) as the target div location to fetch the data from?
The code:
- <body>
- <script type="text/javascript">
- $(window).load (function() {
- var ahash = new String(window.location.hash);
- if ("ahash:contains('#')")
- {
- $('#stuff').load('what-cms.php' + ahash);
- alert("jQuery should now load the contents of the DIV called " + ahash + ", from the page what-cms.php in to the below DIV called stuff");
- }
- }
- else {
- $('#stuff').load('what-cms.php #what-info');
- alert("No hash to load so defult data will be loaded");
- }
- });
- </script>
- <div><a href="#business-services-info">my div</a></div>
- <div id="stuff">Loading...</div>
- </body>