Skip Navigation

[Resolved] Add ajax post button to each search result

This support ticket is created 5 years, 7 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 1 reply, has 2 voices.

Last updated by Minesh 5 years, 7 months ago.

Assisted by: Minesh.

Author
Posts
#1241288

Tell us what you are trying to do?

Check out this site: hidden link
They have a "heart" button on each search result.
I want to achieve that same result using Toolset.
I want to add a heart button to each search result.
When I click that button it should result in an Ajax Post being made to the server. I should be able to add a handler in my functions.php that will handle updating the user's favorites when the button is clicked.

What is the link to your site?

hidden link

I achieved this result on another test version of this site without using Toolset:

hidden link
Note that each "Save" button in the results is actually a submit button for an Elementor form.
I'm using the Elementor Form API described here: hidden link

add_action( 'elementor_pro/forms/new_record', function( $record, $handler ) {
// code to update favorites goes here
}, 10, 2 );

#1241329

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Well - your requirement is such that I would suggest using the readymade plugin that is designed specifically for such a task. If you try to implement using Toolset, it needs customization and I see you are using elementor and for such elementor customizatio, you may need to contact the elementor support.

If you search on google, you will find that there are a number of "Favorites" plugin option is available on the WordPress plugin repo:
=> https://wordpress.org/plugins/favorites/
=> hidden link
=> hidden link
=> hidden link

I suggest you should try to use the above available ready solution and try to resolve your issue.