Are you using Vue JS?
Jun 19, 2019
19
Level 13
Ajax autosave selection without submit button
suppose i click dropdown value then automatically value store in database without page refresh or submit button
please help me
Level 1
check following code i hope this will work for you.
Ajax Status Update
<link href="//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript">
$( "#status" ).change(function() {
var id =$("#hid").val();
var status =$("#status").val();
console.log(status + " " + id);
$.ajax({
type: "GET",
url: "update/"+ id + "status/" + status,
success: function(data){
console.log(data);
$("#update").val(data);
},
});
});
</script>
route file
Route::get('round/update/{id}/{status}',array('as'=>'round.edit','uses'=>'Admin\RoundController@status_update'));
blade file
<input type="hidden" id="hid" value="{{$view->id}}" name="hid">
<select class="form-control m-input" id="status" name="status">
<option value="underprocess" >Under Process</option>
<option value="reject">Reject</option>
<option value="clear">Clear</option><br>
</select>
<div id="autosave"></div>
4 likes
Please or to participate in this conversation.