I want to make a simple CRUD using modal bootstrap and Jquery submit button and framework that i use is laravel 5.2, below is my controller, modal, jquery and routes, the problem is when i click save changes nothing happen, is there anything im doing wrong?
MODAL
<div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h3 class="modal-title"><span class="glyphicon glyphicon-plus"></span> Add Barang</h3>
</div>
<div class="modal-body" id="addModal">
<form id="tambahform" class="form-horizontal" role="form">
<div class="form-body">
<div class="form-group">
<label class="col-md-3 control-label">Name</label>
<div class="col-md-9">
<input type="text" id="client-nama" name="clientName" class="form-control" placeholder="Your Name">
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn-add btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
JQuery
$(document).ready(function(){
var check1=0;
$('#tambahform').submit(function(e){
if (check1==0){
$("#addModal").animate({scrollTop:0}, 'slow');
}else{
e.preventDefault();
var formData = new FormData($(this)[0]);
$.ajax({
url:'form/insert',
data:formData,
type:'POST',
contentType: false,
processData: false,
success:function(data){
$("#addModal").hide();
window.location.reload(true);
}
});
}
return false;
});
Controller
public function insert(){
$nama = Input::get('nama');
$this->nama = Input::get('clientName');
$query = DB::table('profile')->insert(array('nama'=>$nama));
}
ROUTES
Route::get('form/insert', 'FormController@insert');