title: dynamically creating bootstrap dropdown from jQuery AJAX doesnt work
body: <p>I'm new to jQuery, its bin 3 days and before asking i've looked upon all ques here.
  I want to populate the navbar with dropdowns using data from a json file, i'm able to perfectly parse the data but the usage to bootstrap for dropdown, I'm adding classes from jQuery dynamically but they simply wont work, please help.</p>
  
  <p>Heres my index.html</p>
  
  <pre><code>    &lt;html lang="en" xmlns="http://www.w3.org/1999/html"&gt;
  &lt;head&gt;
      &lt;title&gt;JavaScipt AJAX&lt;/title&gt;
      &lt;link rel="stylesheet" type="text/css" href="bootstrap.min.css"/&gt;
      &lt;link rel="stylesheet" type="text/css" href="main.css"/&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div class="navbar secondary-navbar" id="department-nav"&gt;
      &lt;div class="navbar-inner" id="menu"&gt;
  
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;script src="jquery.min.js"&gt;&lt;/script&gt;
  &lt;script src="script_menu.js"&gt;&lt;/script&gt;
  &lt;script src="bootstrap.min.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>sript_menu.js</p>
  
  <pre><code>$( document ).ready(function() {
          $.getJSON( "data.json", function(data) {
                  console.log( data );
                  var menu_item = '&lt;ul class="nav nav-departments nav-featured"&gt;';
                  var output = '&lt;ul class="nav-list"&gt;';
                  $.each(data, function(key, val) {
                      if(val.warehouse_id=="1"){
                          if(val.name=="Produce" || val.name=="Bakery" || val.name=="Dairy &amp; Eggs" || val.name=="Beverages" ) {
                              menu_item += '&lt;li class="dropdown"&gt;';
                              menu_item += '&lt;a class="navbar-link dropdown-toggle"&gt;' + val.name + '&lt;/a&gt;';
  
                              output+= '&lt;li&gt;';
                              output+= '&lt;h2&gt;' + val.name + '&lt;/h2&gt;';
  
                              menu_item += '&lt;ul class="dropdown-menu"&gt;';
                              for(var i=0; i&lt;val.aisles.length; i++) {
                                  output+= '&lt;p&gt;' + val.aisles[i].name + '&lt;/p&gt;';
                                  menu_item += '&lt;li&gt;' + val.aisles[i].name + '&lt;/li&gt;';
                              }
                              menu_item += '&lt;/ul&gt;';
                              menu_item += '&lt;/li&gt;';
                              output+= '&lt;/li&gt;';
                          }
  
                      }
                  });
                  output+= '&lt;/ul&gt;';
                  menu_item+= '&lt;/ul&gt;';
  
                  $('#menu').html(menu_item);
                  $('#update').html(output);
              });
  });
  </code></pre>
  
  <p>Heres my data.json</p>
  
  <pre><code>[
  
  {
      "display_name": "Beer, Wine &amp; Spirits",
      "id": 148,
      "name": "Beer, Wine &amp; Spirits",
      "rank_offset": 991,
      "sort_order": 9,
      "visible": true,
      "warehouse_id": 2,
      "aisles": [{
          "department_id": 148,
          "id": 979,
          "name": "Spirits",
          "rank_offset": 1,
          "visible": true
      }, {
          "department_id": 148,
          "id": 976,
          "name": "Beer",
          "rank_offset": 2,
          "visible": true
      }]
  }, {
      "display_name": "Prepared Food",
      "id": 59,
      "name": "Prepared Food",
      "rank_offset": 990,
      "sort_order": 3,
      "visible": true,
      "warehouse_id": 2,
      "aisles": [{
          "department_id": 59,
          "id": 776,
          "name": "Tofu &amp; Soy",
          "rank_offset": 45,
          "visible": true
      }, {
          "department_id": 59,
          "id": 465,
          "name": "Salads, Sushi &amp; Wraps",
          "rank_offset": 10,
          "visible": true
      }, {
          "department_id": 59,
          "id": 466,
          "name": "Sides &amp; Soups",
          "rank_offset": 40,
          "visible": true
      }, {
          "department_id": 59,
          "id": 468,
          "name": "Whole Meals",
          "rank_offset": 20,
          "visible": true
      }, {
          "department_id": 59,
          "id": 764,
          "name": "Fresh Pasta",
          "rank_offset": 35,
          "visible": true
      }, {
          "department_id": 59,
          "id": 770,
          "name": "Desserts",
          "rank_offset": 50,
          "visible": true
      }, {
          "department_id": 59,
          "id": 771,
          "name": "Fresh Pizza",
          "rank_offset": 30,
          "visible": true
      }]
  }, {
      "display_name": "Grocery",
      "id": 57,
      "name": "Grocery",
      "rank_offset": 997,
      "sort_order": 5,
      "visible": true,
      "warehouse_id": 2,
      "aisles": [{
          "department_id": 57,
          "id": 443,
          "name": "Spices",
          "rank_offset": 100,
          "visible": true
      }, {
          "department_id": 57,
          "id": 444,
          "name": "Baking",
          "rank_offset": 100,
          "visible": true
      }, {
          "department_id": 57,
          "id": 445,
          "name": "Condiments",
          "rank_offset": 100,
          "visible": true
      }, {
          "department_id": 57,
          "id": 446,
          "name": "Peanut Butter &amp; Jelly",
          "rank_offset": 100,
          "visible": true
      }, {
          "department_id": 57,
          "id": 447,
          "name": "Oil, Vinegar &amp; Tuna",
          "rank_offset": 100,
          "visible": true
      }, {
          "department_id": 57,
          "id": 448,
          "name": "Oil &amp; Olives",
          "rank_offset": 100,
          "visible": true
      }, {
          "department_id": 57,
          "id": 449,
          "name": "Canned &amp; Jarred Vegetables",
          "rank_offset": 100,
          "visible": true
      }, {
          "department_id": 57,
          "id": 450,
          "name": "Tomato Sauce",
          "rank_offset": 100,
          "visible": true
      }, {
          "department_id": 57,
          "id": 451,
          "name": "Pasta",
          "rank_offset": 100,
          "visible": true
      }, {
          "department_id": 57,
          "id": 452,
          "name": "Grains, Rice &amp; Dried Beans",
          "rank_offset": 100,
          "visible": true
      }, {
          "department_id": 57,
          "id": 453,
          "name": "Soup",
          "rank_offset": 100,
          "visible": true
      }]
  }, {
      "display_name": "Personal &amp; Home Care",
      "id": 56,
      "name": "Personal &amp; Home Care",
      "rank_offset": 994,
      "sort_order": 6,
      "visible": true,
      "warehouse_id": 2,
      "aisles": [{
          "department_id": 56,
          "id": 435,
          "name": "Vitamins &amp; Supplements",
          "rank_offset": 30,
          "visible": true
      }, {
          "department_id": 56,
          "id": 436,
          "name": "Paper Products",
          "rank_offset": 20,
          "visible": true
      }, {
          "department_id": 56,
          "id": 438,
          "name": "Pets!",
          "rank_offset": 40,
          "visible": true
      }, {
          "department_id": 56,
          "id": 437,
          "name": "Cleaning Products",
          "rank_offset": 10,
          "visible": true
      }, {
          "department_id": 56,
          "id": 778,
          "name": "Personal Care",
          "rank_offset": 28,
          "visible": true
      }, {
          "department_id": 56,
          "id": 779,
          "name": "Soap",
          "rank_offset": 25,
          "visible": true
      }]
  }
  ]
  </code></pre>
  
  <p>thank you for being patient..</p>