Greetings Friends, I have the following WP Hook:
add_action('template_redirect','random_template');
function random_template() {
$posts = get_posts('post_type=post&orderby=rand&numberposts=1');
foreach($posts as $post) {
$link = get_permalink($post);
}
wp_redirect($link,307);
exit;
}
And I have the following Javascript code
$('#Animacion').on("ended", function () {
// This does the ajax request
alert("FIN animacion");
$.ajax({
url: "http://url.sitio",
success: function( data ) {
}
})
});
I need that when an animation that I execute from JS at the end executes the function that I have in WordPress that is a random link, I do not know how to make these two functions connect.
I appreciate a guide.