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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:47:21+00:00 2026-05-16T23:47:21+00:00

I know this can be done easily using jQuery but haven’t been able to

  • 0

I know this can be done easily using jQuery but haven’t been able to find out how to accomplish it with YUI 2.

I am submitting a form via AJAX and in the callback, on success, I want to add the information that was inserted into the existing table in the DOM.

This is what I am trying with no success:

var callback = {
    success: function(o) {
        var result = YAHOO.lang.JSON.parse(o.responseText);
        if (result.success == true) {
            var last_row = YAHOO.util.Dom.getLastChild('tbody_urls');

            var html = '<tr><th>' + result.name 
                + '</th><td><a href="' + result.url + '" title="' + result.url + '">' + result.url.substr(0, 80) + '</a></td><td></td><td></td></tr>';

            var el = YAHOO.util.Dom.insertAfter(html, last_row); // el is being set to NULL so the insert is failing

            YAHOO.util.Dom.get('form_urls').reset();
        }
    },
    failure: function(o) { error(); }
};
  • 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-16T23:47:21+00:00Added an answer on May 16, 2026 at 11:47 pm

    You can’t insert an html string after a node. Try to create a row element, insert the html inside it and append the row element:

    var callback = {
        success: function(o) {
            var result = YAHOO.lang.JSON.parse(o.responseText);
            if (result.success == true) {
                var last_row = YAHOO.util.Dom.getLastChild('tbody_urls');
    
                var html = '<th>' + result.name 
                    + '</th><td><a href="' + result.url + '" title="' + result.url + '">' + result.url.substr(0, 80) + '</a></td><td></td><td></td>';
                var row=document.createElement("tr");
                row.innerHTML=html;
    
                var el = YAHOO.util.Dom.insertAfter(row, last_row); // el is being set to NULL so the insert is failing
    
                YAHOO.util.Dom.get('form_urls').reset();
            }
        },
        failure: function(o) { error(); }
    };
    

    UPDATE
    create a dom element for every td and th

    var callback = {
        success: function(o) {
            var result = YAHOO.lang.JSON.parse(o.responseText);
            if (result.success == true) {
                var last_row = YAHOO.util.Dom.getLastChild('tbody_urls');
    
                var row=document.createElement("tr");
                var th=document.createElement("th");
                th.innerHTML=result.name;
                row.appendChild(th);
                var td=document.createElement("td");
                td.innerHTML='<a href="' + result.url + '" title="' + result.url + '">';
                row.appendChild(td);
                row.appendChild(document.createElement("td"));
                row.appendChild(document.createElement("td"));
    
                var el = YAHOO.util.Dom.insertAfter(row, last_row); // el is being set to NULL so the insert is failing
    
                YAHOO.util.Dom.get('form_urls').reset();
            }
        },
        failure: function(o) { error(); }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that this can be easily done by using if(i%5 == 0 OR
I know this can be easily done using PHP's parse_url and parse_str functions: $subject
I know this can be done and i have seen it done using some
I know I've done this before years ago, but I can't remember the syntax,
I know this is probably something simple but I can't seem to find anything
This is something I know can be done somehow , because I've done it
I know this can seem a weird question but for me it would be
I know this is possible in Perl, but I was wondering if this can
I know this question can be answered by searching in google. But I have
I know this is silly but I can't overcome my curiosity. Is it possible

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.