All the holiday! Help translate Ajax request with jQuery to JS
$('#btn_toggle').on('click', function() { $('.catalog li').each(function(i) { $(this).toggleClass('list'); }); $(this).text(function(i, text) { return text == 'variable1' ? 'variable2' : 'variable1'; }); }); $('#btn_more').on('click', function() { console.log(111); $.ajax({ url: 'ajax_more.php', type: 'post', dataType: 'json', success: function(data) { if (data.result == 'success') { $('#catalog').append(data.html); } } }); }); <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <button id="btn_toggle">variable1</button> <ul class="catalog" id="catalog"> <li>TBD!</li> </ul> <button id="btn_more">More</button>