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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:19:57+00:00 2026-06-08T18:19:57+00:00

I’m using jQuery and AJAX to add rows to a table. I have the

  • 0

I’m using jQuery and AJAX to add rows to a table. I have the following code in a function.

var fila='<tr>';
fila+='<td><select id="listaPagares'+cantFilas+'"></select></td>'; //Keep this in mind
fila+='<td><select id="listaCuotas'+cantFilas+'"></select></td>';
fila+='<td><input type="text" name="valor'+cantFilas+'" id=”valor'+cantFilas+'" /></td>';
fila+='<td id="desc'+cantFilas+'"></td>';
fila+='<td id=”total'+cantFilas+'"></td>';
fila+='</tr>';
$('#lineaDetalle tbody').append(fila);

After this, I do an AJAX request. This same request is used in another table, so I’m pretty sure the XML tags that are searched for work. See the “listaPagares[i]” select line above? In the same function, some lines below, I do this, in the success section of the AJAX request.

$(xml).find('data').each(function()
{
    var errmsg = $(this).find('rowsfound').text();
    if(errmsg!='yes')
    {
        if(errmsg=='no')
        {
            $('#error').text('No se encontraron pagarés.');
        }
        else
        {
            $('#error').text('Rut del alumno o del apoderado erróneos.');
        }
        $('#errmsg').show(500);
    }
    else
    {
        $(this).find('pagare').each(function()
        {
            $('#listaPagares'+cantFilas).append('<option value="'+$(this).find('numpagare').text()+'-'+$(this).find('rbd').text()+'">PAGARÉ N° '+$(this).find('numpagare').text()+' '+$(this).find('nomcolegio').text()+'</option>');
        });
    }
});

However, when I press the button that adds new rows, the second append where I add the options to the select doesn’t work. I’m also pretty sure the program goes through that line, I added an alert before it and it displays. What could be ẃrong? Thank you in advance.

EDIT: I added the entire procedure inside the success clause so you can see why I’m using “this”.

  • 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-08T18:19:58+00:00Added an answer on June 8, 2026 at 6:19 pm

    My solution was as follows:

    I declared a global array with the “cuotas” I wanted to append prior to anything. So, this would happen:

    $('#pagares').change(function()
    {
        $('#errmsg').append(cargaAjax);
        return encPagos();
        $('#errmsg:last-child').remove();
    });
    

    In encPagos this happens:

    $('#pagosHechos table tbody').empty();
    arrCuotas=[];
    $(this).find('pagos').each(function()
    {
        $(this).find('pago').each(function()
        {
            $('#pagosHechos table tbody').append('<tr><td>'+$(this).find('concepto').text()+'</td><td>'+$(this).find('valor').text()+'</td><td>'+$(this).find('pagado').text()+'</td><td>'+$(this).find('dif').text()+'</td><td>'+$(this).find('fvenc').text()+'</td></tr>');
            arrCuotas.push($(this).find('concepto').text());    
        });
    });
    

    So, whenever I add a row, I only have to do this:

    var fila='<tr>';
    fila+='<td><select id="listaCuotas'+cantFilas+'" name="listaCuotas'+cantFilas+'">';
    for(i=0;i<arrCuotas.length;i++)
    {
        fila+='<option value="'+(i+1)+'">'+arrCuotas[i]+'</option>';
    }
    fila+='</select></td>';
    fila+='<td><input type="text" name="valor'+cantFilas+'" id="valor'+cantFilas+'" /></td>';
    fila+='<td id="desc'+cantFilas+'">'+desc+'%</td>';
    fila+='<td id="total'+cantFilas+'"></td>';
    fila+='</tr>'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a jquery bug and I've been looking for hours now, I can't
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I have thousands of HTML files to process using Groovy/Java and I need to
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

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.