lundi 28 novembre 2016

Laravel : Insert data into database using Bootstrap Modal

I want to insert some data into database using Bootstrap Modal. But the problem is Save button doesn't work properly on Bootstrap Modal as I couldn't insert the data into database through form. If anyone could help me to find it please!?

Here is the form part in blade:

<div id="myAlert" class="modal hide">
    <div class="modal-header">
        <button data-dismiss="modal" class="close" type="button">×</button>
        <h3>Create User</h3>
    </div>
    <div class="modal-body">
        <div class="row-fluid">
            <div class="span12">
                <div class="widget-box">
                    <div class="widget-content nopadding">
                        <form action="#" method="get" id="userForm" class="form-horizontal">
                            <div class="control-group">
                                <label class="control-label">Name :</label>

                                <div class="controls">
                                    <input class="span11" placeholder="Name" type="text">
                                </div>
                            </div>
                            <div class="control-group">
                                <label class="control-label">Email :</label>

                                <div class="controls">
                                    <input class="span11" placeholder="Email" type="email">
                                </div>
                            </div>
                            <div class="control-group">
                                <label class="control-label">Password</label>

                                <div class="controls">
                                    <input class="span11" placeholder="Enter Password" type="password">
                                </div>
                            </div>
                            <div class="control-group">
                                <label class="control-label">Confirm Password</label>

                                <div class="controls">
                                    <input class="span11" placeholder="Confirm Password" type="password">
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal-footer"><a data-dismiss="modal" class="btn btn-primary" href="#">Confirm</a> <a
                data-dismiss="modal" class="btn" href="#">Cancel</a>
    </div>
</div> 

Here is the Ajax Part :

 $('#userForm').on('success.form.fv', function(e) {
        e.preventDefault();

        $.ajax({
            method: 'POST',
            action:"",
            data: $form.serialize()
        });
    });  



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire