AJAX question

AJAX question

Trying to do something with AJAX--and failing. Any help welcome.

I have a bunch of pages (page-1.php, page-2.php, etc.) that all share a navigation menu (menu.html), which menu is included in the pages server side. The pages all use jQuery and (obviously) PHP, but the menu is (at the moment) straight HTML. Now I need to add to the menu an item (menu-item.php) that is fetched by AJAX, with which I have precious little experience (in JQuery or anywhere else).

I figured I could just add it to menu.html as follows:

  1. <ul>
  2. <li><a href="...">Menu Item 1</a></li>
  3. <li><a href="...">Menu Item 2</a></li>
  4. <script type="text/javascript">
  5. <!--
  6. $.get("menu-item.php");
  7. //-->
  8. </script>
  9. </ul>
But this doesn't work. The JS of course shows up in the page source, as viewed in FF, but it never fetches menu-item.php. What am I doing wrong?

P.S. The reason I want to use AJAX for this is that menu-item.php returns different content depending on the user's IP. And the reason I want to put it in menu.html is to avoid editing all the pages individually.