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

$(document).ready(function() { $('#content').html(''); $.ajax({ url:'data.json', dataType: json, success: function(data) { $('#content').append('<p>'+data.rank+'</p>'); } });}); In
$('#post_form').submit(function() { $(#ajax_bar_loader).show(); $.ajax({ url: 'add.html', data: $('#post_form').serialize(), dataType: 'json', type: 'post', success: function(
function checkSession(){ $.ajax({url: session.php, success: function(data){ if( data == 1){ var postFilen = 'msg.php';
I am trying to function doRow(rowNum) { $.ajax({ url: z.html, cache: false, success: function(html){
Could someone tell me if this: $.ajax({ url: 'test.html', success: function(data) { alert(Data Loaded:
I am confused as to why an alert is not firing a json response.
I am using a jquery ajax call which accepts json response : var posturl
Having issues referencing $(this) from within a the nested ajax 'success' function... I know
It seems that i cannot access $(this) inside jquery ajax success function. please see
I have $.ajax({ url: identity, success: function(data) { ProcessIdentityServer(data) } }); When 'data' is

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.