Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jQuery('#button').click( function () {
- var vocabulary = jQuery('.selected').children("input").attr("id");
- var user = jQuery('#id_user').attr("name");
- jQuery.ajax({
- url: removeVoca.ajax_url,
- type:'post',
- data : {
- action : 'renove_vocabulary',
- id_vocabulary : vocabulary,
- id_user : user
- },
- success : function(reponse){
- //delete the row
- table.row('.selected').remove().draw( false );
- },
- error: function(xhr){
- //error handling
- console.log("suppression echoué")
- }});
- } );
- } );
- add_action( 'wp_ajax_renove_vocabulary', 'renove_vocabulary' );
- function renove_vocabulary() {
- $id_user = $_POST['user_id'];
- $id_vacabulary = $_POST['vocabulary_id'];
- global $wpdb;
- $reponse = $wpdb-> delete ('wp_user_vocabulary', array ('vocabulary_id' => $id_vacabulary , 'user_id' => $id_user ), array('%d', '%d'));
- wp_die();
- }
Add Comment
Please, Sign In to add comment