Jump to content

[SOLVED] AJAX call stacking html


9three

Recommended Posts

Hey,

 

I'm calling a dynamic php file on click. It retrieves HTML/dynamic info. When I click once, because the DIV is empty, it works perfectly. The problem is when there is content there already.

 

Is there a way to get rid of the HTML thats there already, and THEN load the new HTML?

 

$('#random').click(function () {
    
    $.ajax({
      type: 'POST',
      url: 'ajax/ajax.getInfo.php',
      cache: false,
      success: function (html) {
        $('.infoContainer').append(html);
      }
    });
  });

 

If I've already clicked on the link then it will append the latest request to the bottom.

 

Anyone know how I can accomplish this? thanks

Link to comment
https://forums.phpfreaks.com/topic/176481-solved-ajax-call-stacking-html/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.