Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

83
Views
Collapsed Sidebar with jquery load php file

I would like to build for my website a mega menu like this model: https://jsfiddle.net/pcatydqh/

But I would like to use jquery to load this menu from my popupMenu.php file, I have this jquery code below to load it:

$(document).on('click','.openbtn',function(){
  var xmlhttp;
  if(window.XMLHttpRequest)
  {
      xmlhttp = new XMLHttpRequest();
  }
  else
  {
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  }
  xmlhttp.onreadystatechange=function()
  {
      if(this.readyState==4 && this.status==200)
      {         
      document.getElementById("mySidebar").style.width = "300px";             
      document.getElementById("mySidebar").innerHTML=xmlhttp.responseText;
      document.getElementById("main").style.marginLeft = "300px";
      }
  }
  xmlhttp.open("GET","../scripts/popupMenu.php",true);
  xmlhttp.send();
});

When I click on my menu button (class="openbtn"), it open and display my menu (there is no problem) but I can't open the sub-links into my div class="dropdown-container" by clicking on my button class="dropdown-btn", it doesn't work, how to fix this problem?

Thank you in advance for your help.

Paul

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!