How to do correct loading of posts Ajax in Wordpress?

Taken from the lesson https://misha.blog/wordpress/ajax-pagination.html the following code (created JS, hooked, in this work).

On the archive page/taxonometric added the code and understand that conflict Query requests between them. First 10 records are correct, the rest of the General list of the entire site taken. How can I pass parameters inside podgurski Ajax to display records from the current archive/taxonometric?

query_posts( $query_string.'&order=ASC&orderby=title');
 while ( have_posts() ) : the_post();
 get_template_part( 'postik' );
endwhile;
 if ( $wp_query->max_num_pages > 1 ) : ?>
the <script>
 var ajaxurl = '<?= site_url() ?>/wp-admin/admin-ajax.php';
 var true_posts = '<?= serialize($wp_query->query_vars); ?>';
 var current_page = <?= (get_query_var('paged')) ? get_query_var('paged') : 1; ?>;
 var max_pages = '<?= $wp_query->max_num_pages; ?>';
</script>
 <div id="load_more"></div>
 <? endif;</code-->
June 14th 19 at 20:27
1 answer
June 14th 19 at 20:29

Find more questions by tags AJAXWordPress