Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6052987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:59:21+00:00 2026-05-23T07:59:21+00:00

Basically I’m trying to call a function getTableData that loads a table and places

  • 0

Basically I’m trying to call a function getTableData that loads a table and places it inside the div tableContents.

Then what I’m trying to do is get the id values from each th 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…

    $(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);
                });
            });
        });
    });

What am I doing incorrectly?

<table id='tableData'>
<tr class='tableHeader'>
<th>Modified</th>
<th id='col1'>col1</th>
<th id='col2'>col2</th>
<th id='col3'>col3</th>
<th id='col4'>col4</th>
<th id='col5'>col5</th>
<th id='col6'>col6</th>
<th id='col7'>col7</th>
<th id='col8'>col8</th>
<th id='col9'>col9</th>
</tr>...

function getDBData(type, dbName, tableName) {

    $.ajax({
        type: "GET",
        url: "ajaxDBReturn.asp?type="+ type + "&dbName=" + dbName + "&tableName=" + tableName,
        contentType: "application/json; charset=utf-8",
        success: function (result) {
            if(type == "getTables")
            {
                //result = "<table id='tableList'>" + result + "</table>";
                ($("#tableList").html(result));
            } else if (type == "getTableData") {
                ($("#tableContents").html(result));
            }else if (type == "getTableRelationship"){
                result = "<table id='listTableBody'>" + result + "</table>";
            }



        }
    });

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:59:21+00:00Added an answer on May 23, 2026 at 7:59 am

    As far as I’ve read this quickly. Your .load() function should get an url and not a complete piece of data. If you do, that could result into no actual adding to your data, because the load() method doesn’t load a thing if it doesn’t get a string with an url.

    If you getDBData adds it itself, then there is no succes. You should give your succes function to your getDBData instead and invoke the function after you’re done building your table.

    If this is the case, I would recommend a simple global function call like so:

    $(document).ready(function () 
    {
        $('.tableNames').live('click', function (event) 
        {
            // here is the change
            // do you really need to call $('#tableContents')?
            // you are probably also doing that in the function itself.
            // also give your success function to your home-made function
            getDBData('getTableData', '', $(this).text(), function()
            {
                $('#tableData th').each(function () 
                {
                    var id = $(this).attr("id");
                    // compare id to what you want
                    alert(id);
                });
            });
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically I'm trying to accomplish the same thing that mailto:bgates@microsoft.com does in Internet Explorer
Basically, what I'm trying to create is a page of div tags, each has
Basically i've a table for my users (it's nightclub website) and now i'm trying
Basically, I have a function that has an optional dictionary argument. Since it's optional,
Basically this function is meant to store the height value of the element that
basically I have a function that resizes elements accordingly with jquery triggering the function
Basically I am trying to restart a service from a php web page. Here
Basically, I'm trying to tap into the Soap pipeline in .NET 2.0 - I
Basically I’ve heard that certain conditions will cause .NET to blow past the finally
Basically from a database I am getting data that is formatted like this nameofproject101

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.