How to load visual composer during using ajax in wordpress

Solution:

Since version 4.9 visual composer added shortcode lazy loading. To use VC shortcodes on AJAX content use this function before printing the content WPBMap::addAllMappedShortcodes();

add_action( 'wp_ajax_drpk_custom','drpk_custom' );
add_action( 'wp_ajax_nopriv_drpk_custom','drpk_custom' );
function drpk_custom(){
if(isset($_REQUEST)){
    $id = $_REQUEST['id'];

    $query = new WP_Query(array('p'=>$id));
    if($query->have_posts()):
        while($query->have_posts()): $query->the_post();
            WPBMap::addAllMappedShortcodes();
        ?>
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel"><?php the_title() ?></h4>
      </div>
      <div class="modal-body">
         <?php the_content() ?>
      </div>
        <?php endwhile;

    endif;
}
wp_die();  }