Answer the question
In order to leave comments, you need to log in
Why doesn't asynchronous product display work in WordPress?
Greetings.
There is such a script that connects the php file on click.
$('#form_help').on('submit',function(e){
e.preventDefault();
var self = this;
$.ajax({
url: '/view_test.php',
type: "POST",
cache: false,
data: $(this).serialize(),
success: function(data) {
$('.message').html(data);
}
});
});
$args = array(
'post__in' => array(1, 7, 3869),
'post_type' => 'product',
);
$query = new WP_Query( $args );
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
echo '<li>' . get_the_title() . '</li>';
}
} else {
}
wp_reset_postdata();
Answer the question
In order to leave comments, you need to log in
See what the browser console writes when requesting backing. Most likely, a request error, if the back is guaranteed to respond.
Whatever your load is, the backend doesn’t care at all. For him, your request from JS is the same request as hundreds of others.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question