Skip Navigation

[Resolved] Apply javascript to the results loaded with ajax

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

Problem:

The issue here is that the user wanted to recall an external JS that was imported with a script tag in the theme after the AJAX Pagination.

Solution:
Unfortunately this one seems to may not be possible as this is meant if you have the full javascript code because it would need to be re-initialized in the callback.

However it seems you are getting the script from somewhere else.

In your case I would recommend not using the AJAX pagination since we would need the script that actually add the links to the buttons .

This support ticket is created 6 years, 2 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 2 replies, has 2 voices.

Last updated by goM 6 years, 2 months ago.

Assisted by: Shane.

Author
Posts
#1098633

goM
2018-09-03_21h57_49.png
2018-09-03_21h57_27.png

Tell us what you are trying to do?

On my site, the following script placed inside <head> </ head> is rewriting the normal link to affiliate link.

<script type = "text / javascript" language = "javascript">
     var vc_pid = "1234567890";
</ script> <script type = "text / javascript" src = "// aml.aspcompany.com/vcdal.js" async> </ script>

Note: The value and url are dummy, I attach the provided code.

The url of the item displayed first is correctly rewritten, but if I display the next page with ajax or the parametric search result is called with ajax, the link will not be rewritten.

Is there any documentation that you are following?

https://toolset.com/forums/topic/call-javascript-after-ajax-filter/
and
jQuery( document ).on( 'js_event_wpv_pagination_completed', function( event, data ) {
/**
* data.view_unique_id (string) The View unique ID hash
* data.effect (string) The View AJAX pagination effect
* data.speed (integer) The View AJAX pagination speed in miliseconds
* data.layout (object) The jQuery object for the View layout wrapper
*/

});

Is there a similar example that we can see?
hidden link

In the yellow button link displayed on the first four smartphones, the URL is correctly rewritten.
When loading the next smartphone with the white button placed under the four smart phones, the URL of the yellow button link has not been rewritten.

What is the link to your site?
hidden link

#1098739

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Thank you for contacting our support forum.

Unfortunately this one seems to may not be possible as this is meant if you have the full javascript code because it would need to be re-initialized in the callback.

However it seems you are getting the script from somewhere else.

In your case I would recommend not using the AJAX pagination since we would need the script that actually add the links to the buttons .

Thanks,
Shane

#1101675

goM

Thank you. I will adopt other methods.