jQuery(document).ready(function($) { var billvote = $('#billclassvote').val(); $bill_vote_modal = $('.'+billvote+'-wrap-vote'); $bill_vote_modal.prependTo($('#wpcontent')).slideDown(); $('html, body').scrollTop(0); $('.bill-vote-action').on('click', function(e) { var $this = $(this); url= $this.attr('href'); e.preventDefault(); $.ajax({ type: 'get', timeout: 15000, url: url, beforeSend: function() { // if (typeof $this.data('action') !== 'undefined') if(url.includes('action')) { window.open(url); } }, // success: function(data) {} complete : function () { $($bill_vote_modal).slideUp(); urlsite = $this.data("action"); if(urlsite != undefined) { if(urlsite.includes('http')) { window.open(urlsite); } } } }); }); });