jQuery(document).ready(function($){
     console.log('MsgDetailsMenu.js Ready.....');
     //console.log(SolicitudesAjax);


     $(document).on('click',".delete",function(){
           var id = this.dataset.id;
           var url = SolicitudesAjax.url;
           var result = confirm("Esta seguro?");
           if(!result) return;

           $.ajax({
               type: "POST",
               url: url,
               data:{
                  action  : "peticionsubscribesajax",
                  nonce : SolicitudesAjax.seguridad,
                  id : id,
                  option : "delete"
               },
               success:function(){
                   location.reload();
                }
           });
     });

	 // Eliminar todos los regitros
	 $("#doaction2").on('click',function(){
           var id = this.dataset.id;
           var url = SolicitudesAjax.url;
		   
		   var selector_bottom = $("#bulk-action-selector-bottom").val();
		   
		   if(selector_bottom === "undefined" || selector_bottom==-1){
			   return;
		   }
		   
           var result = confirm("Esta seguro?");
           if(!result) return;

           $.ajax({
               type: "POST",
               url: url,
               data:{
                  action  : "peticiondetailsajax",
                  nonce : SolicitudesAjax.seguridad,
                  id : id,
                  option : "deleteall"
               },
               success:function(){
                   location.reload();
                }
           });
     });


});