Suppose I have created in the loop several modal bootstrap windows, where the main window div is:
<div id="myModal'.$rezult['id'].'" class="modal fade" role="dialog"> Form in the window:
<form id="form'.$rezult['id'].'" action="ajax/insert.php?id='.$rezult['id'].'" method="post"> Window call button:
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal'.$rezult['id'].'">Insert</button> Then in the modal window I placed 2 buttons <input> and <button> , both buttons have the ability to close the window:
<input type="submit" class="btn btn-primary" data-dismiss="modal" value="Сохранить" form="form'.$rezult['id'].'"> <button type="button" class="btn btn-default" data-dismiss="modal">Отменить</button> I used ajaxform plugin to send data from the form, but the type="sumbit" attribute does not work due to the data-dismiss="modal" attribute and as a result the script does not work. Without knowing the exact naming of the form id and the main div'a , I don’t know how I can take the data.
jquery script:
$(this).ajaxForm( { success: function(data) { if(data) { $('#pkSkLapa').html(data); } else { alert("error!"); } } });