• we need a when user click on my button bootsrap modal open in new tab with my define content i am not a big developer so please help me here is my javascript code

    <script>
    
    function ibenic_show_post_js(id){
    jQuery.ajax({
    url: "<?php echo admin_url( 'admin-ajax.php' ); ?>",
    data: { id: id, action: 'ibenic_show_post',},
    success: function(response){
    if(response['error'] == '1'){
    jQuery('#modalTitle').html("Error");
    jQuery('#modalBody').html("No post found! Sorry :(");
    } else {
    	
    jQuery('#modalTitle').html(response['post_title']);
    jQuery('#modalBody').html(response['post_content']);
    }
    
    jQuery('#ibenicModal').modal('show');
    }
    });
    }
    </script>
    
    

    and my button code is

    
    <a href="#" class="btn btn-primary show-code" data-toggle="tab" target="_blank" data-id="<?php the_ID(); ?>" onClick='ibenic_show_post_js(<?php the_ID(); ?> )'>show data</a>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘how to open bootstrap model in new tab’ is closed to new replies.