title: get id values from each <th> element
body: <p>Basically I'm trying to call a function <code>getTableData</code> that loads a table and places it inside the <code>div</code> <code>tableContents</code>.</p>
  
  <p>Then what I'm trying to do is get the id values from each <code>th</code> that is generated from the function. The table loads with the correct data, but the id values do not alert.  I've even put an alert right after the load and nothing pops...</p>
  
  <pre><code>    $(document).ready(function () {
          $('.tableNames').live('click', function (event) {
              $('#tableContents').load(getDBData('getTableData', '', $(this).text()), function () {
             //alert('here');
                  $('#tableData th').each(function () {
                      var id = $(this).attr("id");
                      // compare id to what you want
                      alert(id);
                  });
              });
          });
      });
  </code></pre>
  
  <p>What am I doing incorrectly?</p>
  
  <pre><code>&lt;table id='tableData'&gt;
  &lt;tr class='tableHeader'&gt;
  &lt;th&gt;Modified&lt;/th&gt;
  &lt;th id='col1'&gt;col1&lt;/th&gt;
  &lt;th id='col2'&gt;col2&lt;/th&gt;
  &lt;th id='col3'&gt;col3&lt;/th&gt;
  &lt;th id='col4'&gt;col4&lt;/th&gt;
  &lt;th id='col5'&gt;col5&lt;/th&gt;
  &lt;th id='col6'&gt;col6&lt;/th&gt;
  &lt;th id='col7'&gt;col7&lt;/th&gt;
  &lt;th id='col8'&gt;col8&lt;/th&gt;
  &lt;th id='col9'&gt;col9&lt;/th&gt;
  &lt;/tr&gt;...
  
  function getDBData(type, dbName, tableName) {
  
      $.ajax({
          type: "GET",
          url: "ajaxDBReturn.asp?type="+ type + "&amp;dbName=" + dbName + "&amp;tableName=" + tableName,
          contentType: "application/json; charset=utf-8",
          success: function (result) {
              if(type == "getTables")
              {
                  //result = "&lt;table id='tableList'&gt;" + result + "&lt;/table&gt;";
                  ($("#tableList").html(result));
              } else if (type == "getTableData") {
                  ($("#tableContents").html(result));
              }else if (type == "getTableRelationship"){
                  result = "&lt;table id='listTableBody'&gt;" + result + "&lt;/table&gt;";
              }
  
  
  
          }
      });
  
  }
  </code></pre>