I have a modal popup to change the password and I need to close it on submit button. 

```
<div class="modal-body"> 
    <?php if(isset($message))echo '<span class="text-success txt-upper" style="margin-left:2rem;">'. $message .'</span>';?>

    <?php echo form_open('',array('class'=>'ajaxForm')); ?>
      <fieldset class="table "> 
        <div class="form-group">
        <?php $class = form_error('newpassword')?"input-error":"" ?>
          <div  class="col-md-12" style="margin: 10px 0"><?php echo form_password('newpassword','','class="form-control margin-both-0 '. $class.'" id="newpassword"  placeholder="New Password" autocomplete="off"'); ?><?php echo form_error('newpassword'); ?></div>            
        </div>
        <div class="form-group">
        <?php $class = form_error('conpassword')?"input-error":"" ?>
          <div class="col-md-12 " style="margin: 10px 0"><?php echo form_password('conpassword','','class="form-control  margin-both-0 '. $class.'" id="conpassword"  placeholder="Confirm Password" autocomplete="off"'); ?><?php echo form_error('conpassword'); ?></div>           
        </div>  

</div>
<div class="modal-footer">
        <?php echo form_submit('submit_btn', 'Change Password', 'class="submit btn btn-success margin-left-4p pad-1-rem margin-bottom-10"'); ?>
     </fieldset>
    <?php echo form_close();?>  
  </div>

```

The above code is the form submit button.

```
$(function() {
        $(".submit").click(function(e){
            var sdata = $('.ajaxForm').serialize();
            $.ajax({
                type: "POST",
                data:sdata,
                url: "<?php echo site_url('home/change_password'); ?>",
                success: function(data){
                    $('#baseModal-xs .modal-content').html(data);  
                }
            });
            return false;
        });
    });

<script type="text/javascript">
    $(".submit").ajaxForm(function() { 
        window.close();
    });

```

This is the javascript I have added the windows.close function isn't working