[ad_1]
Hello,
we used to load the GTranslate Shortcode by click (for reasons of data protection). Recently it stopped loading. Do you havy any idea, what could be the reason why?
This is the button used in our theme:
<button id="trigger_translation">Google Translate aktivieren</button>This is in the functions.php
(When I insert a shortcode from another plugin there, it works)
// Translation on click
function runTranslation() {
if ( isset($_REQUEST) ) {
echo do_shortcode( '[gtranslate]' );
}
die();
}
add_action( 'wp_ajax_runTranslation', 'runTranslation' );
add_action( 'wp_ajax_nopriv_runTranslation', 'runTranslation' );This is the javascript code:
// load translation
$('#trigger_translation').click(function(e) {
e.preventDefault();
$.ajax({
url: '/wp-admin/admin-ajax.php',
type: 'GET',
data: {
'action' : 'runTranslation',
},
success:function(data) {
$('#translation').html(data);
}
});
});
});- This topic was modified 1 hour, 16 minutes ago by .
The page I need help with: [log in to see the link]
