simple .load problem

simple .load problem

i can't seem to get .load() working.  i am sad.  please help?
simplest setup i could put together:

[index.html]

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3.     <head>
  4.     
  5.         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <script type="text/javascript" src="js/jquery-1.5.js" />
  7.     <title>Test</title>
  8. <script type="text/javascript">
  9. $(document).ready(function () {
  10. alert("jquery script executing...");
  11. $('#foo').load('more.html #bar', loadComplete);
  12. });
  13. function loadComplete (response, status, xhr) {
  14. alert("load complete.");
  15. }
  16. </script>
  17. </head>
  18. <body>
  19. <div id="foo">
  20. foo foo foo
  21. </div>
  22. </body>
  23. </html>


[more.html]

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3.     <head>
  4.         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5.     <title>More</title>
  6. </head>
  7. <body>
  8. <div id="bar">
  9. bar bar bar
  10. </div>
  11. </body>
  12. </html>


i see both the alerts -- the script is being executed, and the callback is being called (i.e. the load is completing).  however, the contents of  <div id="foo"do not change.  i've tried on safari, chrome, and firefox, all on OSX.  there must be something obvious i'm missing...?

thanks!

      • Topic Participants

      • eric