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

  • Home
  • SEARCH
  • 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 8524301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:39:00+00:00 2026-06-11T07:39:00+00:00

I have a table in my phtml file. <table width=700 class=detais cellpadding=10px;> <tr><td></td><td></td></table> I

  • 0

I have a table in my phtml file.

<table width="700" class="detais" cellpadding="10px;">
<tr><td></td><td></td></table>

I also have a drop down, on change of this drop down it will call a javascript which is

function filterbyaptno(){
     var idno = document.getElementById("aplist").value;
      $.ajax({
        url: 'address',
        type: 'POST',                    
        data:"idno="+idno,
         success:function(result) { 
            var numRecords = parseInt(result.rows.length);
            if(numRecords>0)
            {
              for(var i = 0; i<numRecords;i++)
               {
                 var html ='<div class="support"><table><tr>      <td>'+result.row[i].firstname+'</td>                        
               +'<td>'+result.rows[i].advice+'</td>'         
               +'<td>'+result.rows[i].customdata+'</td><tr></table></div>' 
               }
           $('.detais').replaceWith(html);//am trying to change the table content
             }
         });
   } 

But what happens if the result has more records it just give me only the last record.
And also if i change the drop down again it never works.
Can anyone help me how to do this? Is there any way in javascript to modify the content of the table based on the response of controller;

  • 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-11T07:39:01+00:00Added an answer on June 11, 2026 at 7:39 am

    As you loop the results you:

    var html = ..
    

    which replaces whats already in the html variable.

    Declare var html outside the for loop & always append (html += ...) within the loop.

    You probably also want to setup the container <div class="support"><table> outside the loop also, only adding rows within.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table and this table contain result column with some entries. I just
I have table with 300 000 records (MyISAM). I get record from this table
I have table with two columns (varchar from, varchar to). This table represents connections
I have table with this structure ID | Parameter1 | Parameter 2 | Multiplication
I am creating a custom module in magento.I have created block class and phtml
I have table in an MS Access database that looks like this: ID Symbol
I have Login.php form like this: class Form_Login extends Zend_Form { public function init()
I have table with 2 columns: id and name. need trigger which at change
I have table which will only contain information about files, so, as the file
I have table structure like this: ID cond 1 5 1 2 1 6

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.