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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:58:15+00:00 2026-05-25T19:58:15+00:00

success: function(json) { for (var i = 0; i < json.length; i++) { var

  • 0
success: function(json) {
            for (var i = 0; i < json.length; i++) {
        var response = json[i];
         $('#rv-container').html('<p>' + response.name + '</p>' + '<span>' + response.id + '</span>');
    }
        $('#history_tracking').hide();
    
        }

In the success callback $(#rv-container).html() will not work, but .prepend does.

Why doesn’t jQuery allow for .html in the success callback?
The problem is the html loaded via ajax keeps on piling up ontop of the data already loaded. So it doesn’t replace the data currently in the #rv-container

HTML:

<div id="bottom-toolbar">
  <div id="rv-facet">
    <div id="rv-fix">
      <li id="rv-title">
        Recently Viewed <span class="total_viewed"></span>
        <div id="rv-total" style="float:right; margin-right:25px;"></div>
      </li>
    </div>
    <div id="rv-content">
      <div id="rv-container">
        <div id="history_tracking"></div>
      </div>
    </div>
  </div>
</div>

Is there anyway to have prepend replace the contents of the div?

  • 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-25T19:58:16+00:00Added an answer on May 25, 2026 at 7:58 pm

    You are calling it in a loop, so obviously it makes a difference whether you are resetting the HTML content over and over (.html()) or prepending more and more to it (.prepend())?

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

Sidebar

Related Questions

I am trying to function doRow(rowNum) { $.ajax({ url: z.html, cache: false, success: function(html){
I have $.ajax({ url: identity, success: function(data) { ProcessIdentityServer(data) } }); When 'data' is
Hi guys i'm new to JSon and not too sure how do i pass
Please consider the following view: <p>Count <span data-bind=text: unreadCount()>&nbsp;</span></p> <div data-bind='template: { name: conversationTemplate,
I do <script type=text/javascript src=Scripts/jquery-1.4.1.min.js></script> <script type=text/javascript> function CallPageMethod(methodName, onSuccess, onFail) { var args
function EmpCode(empCode) { var queryString = ; var hasQuerystring = document.URL.indexOf('?'); if (hasQuerystring !=
function manageVoting() { var parameter; var myVoting; var divVoting; var divVotes; var value =
Updated with actual JSON Response, Messed up last time. It is my second day
function addphoto() { var ajaxRequest = initAjax(); if (ajaxRequest == false) { return false;
I have the following code $(document).ready(function(){ // class exists if($('.delete').length) { // add click

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.