v0.10.0b - Fixed Location update AJAX
Added - You are now able to delete a location
This commit is contained in:
@@ -30,8 +30,6 @@
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
|
||||
//Dont delete me, if the user reloads the pages with text in the text-box this code runs.
|
||||
$(document).ready(function () {
|
||||
$value = $('#name').val();
|
||||
@@ -83,7 +81,5 @@
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
@csrf
|
||||
@method("put")
|
||||
<label for="name">Lokationsnavn:</label>
|
||||
<label hidden id="error" for="errormesseages">Lokation findes allerede</label>
|
||||
<input type="text" name="name" id="name" value="{{ $location->name }}" required>
|
||||
<input type="submit" class="btn btn-dark text-white" value="Rediger">
|
||||
<input type="submit" id="disable" class="btn btn-dark text-white" value="Rediger">
|
||||
</form>
|
||||
@endsection
|
||||
@section("scripts")
|
||||
@@ -29,5 +30,57 @@
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
//Dont delete me, if the user reloads the pages with text in the text-box this code runs.
|
||||
$(document).ready(function () {
|
||||
$value = $('#name').val();
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '{{route('locations.nameCheckUpdate')}}',
|
||||
data: {'nameCheck':$value, 'id':{{$location->id}}},
|
||||
success:function (data) {
|
||||
console.log(data);
|
||||
if(data){
|
||||
$("#error").show(100);
|
||||
$("#error").css('color', 'red');
|
||||
$("#disable").prop('disabled', true);
|
||||
$('#disable').css('cursor','not-allowed');
|
||||
}else{
|
||||
$("#error").hide();
|
||||
$("#disable").prop('disabled', false);
|
||||
$('#disable').css('cursor','pointer');
|
||||
}
|
||||
|
||||
},
|
||||
error:function (data) {
|
||||
console.log(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#name').on('keyup', function () {
|
||||
$value = $(this).val();
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '{{route('locations.nameCheckUpdate')}}',
|
||||
data: {'nameCheck':$value, 'id':{{$location->id}}},
|
||||
success:function (data) {
|
||||
if(data){
|
||||
$("#error").show(100);
|
||||
$("#error").css('color', 'red');
|
||||
$("#disable").prop('disabled', true);
|
||||
$('#disable').css('cursor','not-allowed');
|
||||
}else{
|
||||
$("#error").hide();
|
||||
$("#disable").prop('disabled', false);
|
||||
$('#disable').css('cursor','pointer');
|
||||
}
|
||||
|
||||
},
|
||||
error:function (data) {
|
||||
console.log(data);
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
Reference in New Issue
Block a user