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:
$('body').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