I use this javascript function to display popup passing url as arguments, but I want the form to display automatically without onclick, and its not working. 
<!-- show_modal.php included in body  -->
  <script type="text/javascript">
    function showModal(url)
    {
        // SHOWING AJAX PRELOADER IMAGE
        jQuery('#modal_ajax .modal-body').html('<div style="text-align:center;margin-top:200px;"><img src="assets/images/preloader.gif" /></div>');
        // LOADING THE AJAX MODAL
        jQuery('#modal_ajax').modal('show', {backdrop: 'true'});
        // SHOW AJAX RESPONSE ON REQUEST SUCCESS
        $.ajax({
            url: url,
            success: function(response)
            {
                jQuery('#modal_ajax .modal-body').html(response);
            }
        });
    }
    </script>
<!-- (Ajax Modal)-->
    <div class="modal fade" id="modal_ajax">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h4 class="modal-title"><?php echo $system_name;?></h4>
                </div>
                <div class="modal-body" style="height:500px; overflow:auto;">
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                </div>
            </div>
        </div>
    </div>
<!-- show_modal.php ends -->
PHP $url variable
<?php $url = "'".base_url() . "index.php?modal/popup/student_add/1'";?>
Call automatically
<script type="text/javascript">
 $(document).ready(function(){
      showModal(<?=$url?>); 
 }); 
 </script>
When I call documentready : just displays dark background
it works with onclick
<a href="#" onclick="showModal(<?=$url?>);" > </a> 
Console:
 
     
     
    