Title: JetSearch AJAX functionality issue
Last modified: April 27, 2021

---

# JetSearch AJAX functionality issue

 *  Resolved [jurez123](https://wordpress.org/support/users/jurez123/)
 * (@jurez123)
 * [5 years ago](https://wordpress.org/support/topic/jetsearch-ajax-functionality-issue/)
 * Hi!
    I’m building a tutoring website, and I’ve found your plugin to be useful
   in creating reviews for the instructors. It works great with using the [ratemypost-
   result] shortcode in archive pages with Anywhere Elementor, so you can feel free
   to add that to compatible plugins. Thank you for the great plugin! Anyway, here’s
   the issue I’ve run into. I’d like the ratings to be displayed inside the ajax
   search ratings of the JetSearch plugin, as that would look simply brilliant. 
   Unfortunately, the shortcode placed in the plugin template loop doesn’t fetch
   any data. Is there anything I’m doing wrong?
 * Here’s the code that’s in the plugin editor:
 *     ```
       <?php
       /**
        * Results Item js template
        */
       ?>
   
       <div class="jet-ajax-search__results-item">
       	<a class="jet-ajax-search__item-link" href="<code>data.link</code>" target="<code>data.link_target_attr</code>">
       		<code>data.thumbnail</code>
       		<div class="jet-ajax-search__item-content-wrapper">
       			<code>data.before_title</code>
       			<div class="jet-ajax-search__item-title"><code>data.title</code></div>
       			<code>data.after_title</code>
       			<?php echo do_shortcode('[ratemypost-result]'); ?>
       			<code>data.before_content</code>
       			<div class="jet-ajax-search__item-content"><code>data.content</code></div>
       			<code>data.after_content</code>
       			<code>data.rating</code>
       			<code>data.price</code>
       		</div>
       	</a>
       </div>
       ```
   
 * You’ll find the php shortcode echo line in between the data.after_title and data.
   before_content stuff.
    You can type in “hrv” in the search. Also, under it there’s
   a post archive where you can see the post ratings being displayed correctly. 
   Let me know, thanks!
    -  This topic was modified 5 years ago by [jurez123](https://wordpress.org/support/users/jurez123/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fjetsearch-ajax-functionality-issue%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Support [Blaz K.](https://wordpress.org/support/users/blazk/)
 * (@blazk)
 * [5 years ago](https://wordpress.org/support/topic/jetsearch-ajax-functionality-issue/#post-14371430)
 * Hi [@jurez123](https://wordpress.org/support/users/jurez123/),
 * I’m happy to hear you like the plugin. RMP initializes rating/results widgets
   on page load. Since you are adding results widget in ajax search they are no 
   present in DOM on page load and thus they don’t get initialized. But there is
   a solution for that 🙂 You can use the RateMyPost.re_init(); JS function. This
   function was initially added for compatibility with infinitive scroll plugins
   but should work just fine also in your case. So basically after search results
   are loaded you need to call RateMyPost.re_init(). See the example in the [documentation](https://blazzdev.com/documentation/rate-my-post-documentation/#js-functions)
   for more info.
 * Regards,
    Blaz
 *  Thread Starter [jurez123](https://wordpress.org/support/users/jurez123/)
 * (@jurez123)
 * [5 years ago](https://wordpress.org/support/topic/jetsearch-ajax-functionality-issue/#post-14371593)
 * Hi Blaz, I actually managed to solve this issue now.:D
    I’ve figured out that
   the AJAX would indeed be a problem here. That’s why I tried to find out where
   the stuff that’s outside of the loop gets called back in. I’m no expert in this,
   so excuse my lack of proper terminology!
 * I went in the file ajax-handlers.php and added a new line of code:
    ‘reviews’
   => do_shortcode(‘[ratemypost-result id=”‘.$post->ID.'”]’),
 * and inserted it back in the template php file with
    `data.reviews`
 * That worked like a charm.Thank you for the fast response!
 * Kind Regards,
    Jure

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘JetSearch AJAX functionality issue’ is closed to new replies.

 * ![](https://ps.w.org/rate-my-post/assets/icon-128x128.png?rev=2045796)
 * [Rate My Post - Star Rating Plugin by FeedbackWP](https://wordpress.org/plugins/rate-my-post/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/rate-my-post/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/rate-my-post/)
 * [Active Topics](https://wordpress.org/support/plugin/rate-my-post/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/rate-my-post/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/rate-my-post/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [jurez123](https://wordpress.org/support/users/jurez123/)
 * Last activity: [5 years ago](https://wordpress.org/support/topic/jetsearch-ajax-functionality-issue/#post-14371593)
 * Status: resolved