We help IT Professionals succeed at work.
Get Started

Jquery load method working on wordpress home page, not on other pages/posts

Chris Andrews
Last Modified: 2015-05-04
I want to load my main menu using the jquery load method.

I'm using this code in my wordpress theme's header.php file:


<div id="UBmenu"></div>
   <script type="text/javascript">
$(function() {
   $( "#UBmenu" ).load( "http://www.(mySite).com/menu/menu.html" );


It works... but only on the home page. It doesn't load on any of the other pages and posts. The code is in the source code, but for some reason it's not showing the menu.

I'm stuck - can you help troubleshoot this?

Here's my home page:


just click on any of the other pages/posts and you'll see it's not loading on those.

Thanks for any assistance,

Watch Question
Top Expert 2015
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE