title: How to call the php function from the jQuery in Wordpress
body: <p>I am displaying the category dropdown on my page and onChange event I have to call <code>latestBlogView()</code> function.</p>
  <p>My all the codes are in function.php page.</p>
  <ol>
  <li>Do I need to use AJAX?</li>
  <li>Is it possible to do without AJAX?</li>
  </ol>
  <p>I have to call this function</p>
  <pre><code>function latestBlogView($atts){
      var_dump($atts);
      $postData=$atts; // this code is for testing i have to use WP_Query here
      return $postData; 
  }
  add_shortcode( 'latestblogs', 'latestBlogView');
  </code></pre>
  <p>Displaying the dropdonw on my page</p>
  <pre><code>function categoriesDropdown(){
  $categories = get_categories( array(
      'orderby' =&gt; 'name',
      'order'   =&gt; 'ASC',
      'taxonomy' =&gt; 'blogs_cat',
  ) );
   $output='';
   $output.='&lt;select name=&quot;catDropdown&quot; id=&quot;catDropdown&quot;&gt;';
  foreach( $categories as $category ) {
      $output.='&lt;option value=&quot;'.$category-&gt;term_id.'&quot;&gt;'.$category-&gt;name.'&lt;/option&gt;'; 
  }
      $output.='&lt;/select&gt;';
      $output.='&lt;script src=&quot;https://code.jquery.com/jquery-3.5.1.slim.min.js&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;&lt;script&gt;(function($){$(&quot;#catDropdown&quot;).change(function() {
      var value=$(&quot;#catDropdown&quot;).val();
      latestBlogView(value); // calling function here
      });
      })(jQuery)&lt;/script&gt;';
      return $output;
  }
  add_shortcode( 'showCategoryList', 'categoriesDropdown');
  </code></pre>