title: WordPress load posts onClick when posts have specific value in meta_key
body: <p>On the Create Company page you can insert name, year and version. After you press Save it will save the information together with a generated token to a wordpress post as metadata and the category company. if you click on "show companies" it will load all posts with category company from the current user and put 2 buttons next to it. One button to create a new feedbaack which will be saved in another post with category feedback and another token. and if you press the show feedback it should load all the posts with category feedback and the same token as the one from the created company. so you can make multiple feedback for a company and then show it again on click button.</p>
  
  <p><a href="https://i.stack.imgur.com/rJ9hC.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rJ9hC.jpg" alt="enter image description here"></a></p>
  
  <p>Test 5, Test 2 and Test 1 are all earlier created companies where i would like to be able to load their specific feedbacks<br>
  <a href="https://i.stack.imgur.com/cR6dS.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cR6dS.jpg" alt="enter image description here"></a></p>
  
  <pre><code>&lt;div class="show_feedback"&gt;
  &lt;?php 
  // the query
      global $current_user;
      $author_query = array('posts_per_page' =&gt; '-1', 'author' =&gt; $current_user-&gt;ID, 'cat' =&gt; '3', 'meta_key' =&gt; 'cToken', 'meta_value' =&gt; '4IWCTq7OCa3eyxi');
      $wpb_feedback_query = new WP_Query($author_query);
  ?&gt;
  &lt;?php if ( $wpb_feedback_query-&gt;have_posts() ) : ?&gt;
  &lt;ul&gt;
      &lt;!-- the loop --&gt;
      &lt;?php while ( $wpb_feedback_query-&gt;have_posts() ) : $wpb_feedback_query-&gt;the_post(); ?&gt;
          &lt;li&gt;
          &lt;?php the_title(); ?&gt;
          &lt;/li&gt;
      &lt;?php endwhile; ?&gt;
      &lt;!-- end of the loop --&gt;
  &lt;/ul&gt;
  &lt;?php wp_reset_postdata(); ?&gt;
  &lt;?php else : ?&gt;
      &lt;?php _e( 'Sorry, no posts matched your criteria.' ); ?&gt;
  &lt;?php endif; ?&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>this code is what i have so far but at the moment the meta_value is static but should be different for each of the posts before.</p>
  
  <pre><code>function startFeedback(postId){
      $.ajax({
          type: "POST",
          url: ajax_object.ajax_url,
          data:{
          action:'create_feedback', 
          postId: postId,
          eFirstName: $("#eFirstName").val(), 
          eLastName: $("#eLastName").val(),
          eDepartment: $("#eDepartment").val()
          },
          success:function(response) {
          $("#result").html(response);
          }
      });
  }
  
  function showFeedback(postId){
      $(".show_company").hide();
      $(".show_feedback").show();
  }
  </code></pre>
  
  <p>thats the onclick handler which is showing the hidden class to show the post loop</p>