Skip Navigation

[Resolved] Video doesn’t play after AJAX results update

This thread is resolved. Here is a description of the problem and solution.

Problem: Video do not play with AJAX view pagination

Solution: Views offers ajax callback events. When you visit view's Filter section's JS box - you will see a button "Frontend Events" which will allow you to add AJAX calllback events for AJAX view.

You can find proposed solution in this specific case with the following reply: => https://toolset.com/forums/topic/video-doesnt-play-after-ajax-results-update/#post-574064

Relevant Documentation:

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 5 replies, has 2 voices.

Last updated by timE 2 years, 10 months ago.

Assigned support staff: Minesh.

Author
Posts
#573581

I am trying to: Use a parametric filter

Link to a page where the issue can be seen: hidden link

I expected to see: The filter works, but after the filter the vidoes don't play

I kind of know what the problem is, just not how to fix it. When the AJAX results are updated the page reloads but the click javascript doesn't get reloaded on the video overlay.

So I think it's to do with getting this code into the page after AJAX refresh:

function() {
  var $this = $(this);
  et_pb_play_overlayed_video($this);
  return false;
}
#573672

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - Views offers ajax callback events that may help you here.

When you visit view's Filter section's JS box - you will see a button "Frontend Events". When you click it it will allow you to choose ajax callback events for parametric search.

Refer this image:
=> hidden link

For example:

jQuery( document ).on( 'js_event_wpv_parametric_search_results_updated', function( event, data ) {
    /**
    * data.view_unique_id (string) The View unique ID hash
    * data.layout (object) The jQuery object for the View layout wrapper
    */
        
YOUR CUSTOM CODE GOES HERE
       
});
#573854

Thanks Minesh. Although I'm still not sure what to put into the "YOUR CUSTOM CODE GOES HERE" part.

Any chance of a bit more help with this?

Thanks

#573977

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - you should try to replace your custom JS code that should run after the ajax request with "YOUR CUSTOM CODE GOES HERE".

If you can share more information - I will try to help you out.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#574064

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Could you please check now. I've added the following code to your archive's filter section's JS box:

jQuery( document ).on( 'js_event_wpv_parametric_search_results_updated', function( event, data ) {
	/**
	* data.view_unique_id (string) The View unique ID hash
	* data.layout (object) The jQuery object for the View layout wrapper
	*/
  
  jQuery( '.et_pb_post .et_pb_video_overlay, .et_pb_video .et_pb_video_overlay, .et_pb_video_wrap .et_pb_video_overlay' ).click( function() {
				var $this = jQuery(this);
				et_pb_play_overlayed_video( $this );
    			return false;
			} );
	
});

I can see now the video is working after ajax refresh. 🙂

#574083

That's great. Thanks Minesh. I need to go to JS school!