Having issues reloading page results without refreshing whole page.

I have a dropdown that selects a value, that value then dictates pulling posts from specific categories of CPT to output similar items from that value.

I would prefer the whole page to not reload and only the sections that become populated based off the drop down selection

‘$station_data_slug = $tax_name->slug; ‘ is the value that gets passed along on the refresh, I would want that to reload without the refresh

<form id="stationform" method="post"> 
        echo '<select name="stationform" onchange="change()">';
        echo '<option value="" selected="selected">Select Station</option>';
        $args2 = array(
            'show_option_none' => __( 'Select Station' ),
            'echo'             => 0,
            'taxonomy'      => 'stations',
            'hide_empty'        => 0,
            'exclude'       => '66' //add the rest of Batt/EmsQA ids
        $categpries = wp_dropdown_categories ( $args2 );
        $categories = get_categories( $args2 );
        foreach ( $categories as $category ) :

        echo '<option value="' . $category->term_id . '">' . $category->name . '</option>';


        echo '</select>';

function change(){

                        $station = $_POST['stationform'];
                        $tax_name = get_term($station, 'stations');
                        $station_data_slug = $tax_name->slug;
                        $station_data_name = $tax_name->name;
                        $mc_event_cat_id = get_term_by('name',$station_data_name, 'mc-event-category');
                        $mc_event_cat_id_format = $mc_event_cat_id->term_id;
                        $mc_event_id = $mc_event_cat_id_format - 1;

} else; ?>      
<?php endif; ?>

Read more here: reload query based off selection from dropdown list using ACF fields in wordpress


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: