Skip Navigation

[Resolved] Javascript loading in ajax view

This support ticket is created 3 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 4 replies, has 3 voices.

Last updated by Dido 3 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#1818159

Hi,
on this website hidden link
I use a javascript for the masonry sorting. When I click on a filter, the javascript is not loading, because it is in the header.
When I put the script in the view, I got errors. What can I do to solve this?

#1819105

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

There is a custom JS event that you can use to add back the masonry code (which is lost when a filter is applied), namely

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
	*/
	
});

You may like to know if you use Blocks (rather than the legacy Views) then a Masonry grid is one of the output options, you wouldn't need a custom solution.

#1824865

I added the code you provided in the view, but it was not the solution yet.
I will look again to my script. I copied it from the original website, but the maker combined more scripts in one file.
So I will clean it up first.

hidden link is the website I have to remake in WordPress.

#1825087

Minesh
Supporter

Languages: English (English )

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

Ok - please make sure you do not have any Javascript error with your browser's console and yes, please remove unwanted scripts and let me know if you require further assistance.

#1827901

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.