Once a button is clicked, and it loads the content from a difference source. How would I stop it from reloading the content again, especially when I click through other buttons? Below, I have button working as tabs/toggles. I have it where once I click on a button, it loads the content in a div. The content is a bunch of checkboxes with values, which the values are different for each tab. Currently I have it where if you click on button, it brings the content, but then when you click on another button to check other checkboxes, it erases the previous content checked. Want to be able to click on button, check what I need to, go to another button to display content and go back to the original if need to.So How would I only load the content just once to keep it from uploading again and erasing the previous content?
Button HTML
<ul class="category">
<li><a href="#web" class="category-btn web-btn">WEBSITE</a></li>
<li><a href="#page" class="category-btn cama-btn">PAGES</a></li>
<li><a href="#document" class="category-btn">DOCUMENTATION</a></li>
</ul>
Code to the container which will display the checkboxes of products the user can choose from.
<div id="product_container" >
<div class="website box" >
<div class="tx-row" id='webin' >
</div>
<div class="tx-row" id='webx' >
</div>
</div>
<div class="page box" >
<div class="tx-row" id='pagein' >
</div>
<div class="tx-row" id='pagex' >
</div>
</div>
<div class="document box" >
<div class="tx-row" id='documentin' >
</div>
<div class="tx-row" id='documentx' >
</div>
</div>
</div>
JQuery on loading the content of checkboxes per category.
$(document).ready(function(){
var $content = $('.box');
function showContent(type) {
$content.hide().filter('.' + type).show();
}
$('.category').one('click', '.web-btn', function(e) {
$("#webin").load("/wp-content/themes/child/search-web.php");
$("#webx"+").load("/wp-content/themes/child/search-notlikeweb.php");
showContent(e.currentTarget.hash.slice(1));
e.preventDefault();
});
$('.category').on('click', '.page-btn', function(e) {
$("#pagein").load("/wp-content/themes/child/search-page.php");
$("#pagex").load("/wp-content/themes/child/search-notlikepage.php");
showContent(e.currentTarget.hash.slice(1));
e.preventDefault();
});
$('.category').on('click', '.document-btn', function(e) {
$("#documentin").load("/wp-content/themes/child/search-document.php");
$("#documentx").load("/wp-content/themes/child/search-notlikedocument.php");
showContent(e.currentTarget.hash.slice(1));
e.preventDefault();
});
$(".box").hide();
});