Hi I'm trying to get data via ajax for laravel. This is my code. Controller,
public function findByAjaxCode(Request $request)
{
return $request->crime_code;
}
}
Jquery,
$('.serch_crime_by_code').click(function(e){
e.preventDefault();
$.post( "/admin/find_crime_by_ajax", { crime_code: $('crime_code').val() }, function(data){
alert(data);
});
});
Form,
<form class="form-edit-add find_crime" role="form" method="POST" enctype="multipart/form-data">
<!-- PUT Method if we are editing -->
<div class="form-group">
<label class="control-label" for="name">Enter crime code</label>
<input type="text" class="form-control crime_code" id="crime_code" name="crime_code"placeholder="Crime code" value="">
</div>
<button type="submit" class="btn btn-primary pull-right serch_crime_by_code" v-on:click='searchCrime'>
</button>
</form>
But I'm only getting empty result for alert always...
from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2XzFR6z
via IFTTT
Aucun commentaire:
Enregistrer un commentaire