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 8869333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:27:46+00:00 2026-06-14T17:27:46+00:00

I am trying to display the results of a database query on a web

  • 0

I am trying to display the results of a database query on a web page. I’m using the JQUERY script below to get the data as a JSON array via a php script.

For some reason I can’t figure out, the web page. is blank. Note the alert shows the data is being passed to the $.each loop correctly.

Can anyone tell me what I’m doing wrong??

Thanks
Chris

JQUERY SCRIPT

function projectData()
{

var data = '';

    $.ajax(
    {
        url:"projectdata.php", 
        type: "POST",
        dataType: 'JSON',
        cache: false,
        success:function(data)
        {
            $( "#projectList" ).insertAfter('<tbody>' + 

                $.each(data, function(indx, value) 
                {
                    '<tr><td>' + data[indx].project_id + '</td>' +
                    '<td>' + data[indx].dept + '</td>' +
                    '<td>' + value.projName + '</td>' +
                    '<td>' + data[indx].notes + '</td>' + 
                    '<td>' + data[indx].dates + '</td>' +
                    '<td>' + data[indx].status + '</td>' +
                    alert("ID: " + value.project_id + "   " + "DEPT: " + data[indx].dept);
                } //end function
                ) //end each
                ) //end After

        } //end success
    }); //end ajax

} //end projectdata


HTML SCRIPT

Existing Projects:

&lt; table id="projectList">    
&lt; thead>  
&lt; tr class="success">   
&lt; th class="span1">PROJECT ID &lt; /th>  
&lt; th class="span2">SCHOOL / DEPT &lt; /th>  
&lt; th class="span1">PROJECT &lt; /th>  
&lt; th class="span3">DESCRIPTION / PROJECT NOTES &lt; /th>  
&lt; th class="span1">APPROX DATES &lt; /th>  
&lt; th class="span1">STATUS &lt; /th>  
&lt; th class="span1">USER</th> &lt; /tr>  
&lt; /thead>  
&lt; tbody>  
&lt; !-- RESULTS FROM JQUERY/PHP GOES HERE -->  


&lt; /tbody>  
&lt; /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-06-14T17:27:47+00:00Added an answer on June 14, 2026 at 5:27 pm

    You have a syntax error

    $( "#projectList" ).insertAfter('<tbody>' + 
    
    $.each(data, function(indx, value) 
    {
       '<tr><td>' + data[indx].project_id + '</td>' +
    

    This doesn’t make any sense

    Maybe this is what you wanted to do

    var result = "";
    $.each(data, function(indx, value) 
    {
       result += '<tr><td>' + data[indx].project_id + '</td>' +
                    '<td>' + data[indx].dept + '</td>' +
                    '<td>' + value.projName + '</td>' +
                    '<td>' + data[indx].notes + '</td>' + 
                    '<td>' + data[indx].dates + '</td>' +
                    '<td>' + data[indx].status + '</td></tr>';
    }
    $("#projectlist").insertAfter('<tbody>' + result + '</tbody>');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm trying to connect query a database and display the results in a Spinner.
I am using JQuery Full Calendar to display the results of a JSON feed
I'm trying to display in graph my results of BMI. Data come from database.
I'm trying to fetch query results from Joomla MySQL database in a Joomla page.
HI, I am trying to display results from a database in results.php. In the
I'm using plone and trying to display a form result in a page template.
Im trying to display some files in a web page so the user can
I am trying to display data that I am getting from server through json.
I am currently using phonegap and trying to display results from a sqlite table
Trying to use Zend_Search_Lucene to search a MySql database and display the results. Running

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.