Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('#tastingInputModal').on('submit', function (e) {
- e.preventDefault();
- var turn_id = $('#tasting-date-select').val();
- var token = $('#token').val();
- var url = '/saveTasting';
- var comment = $('#tasting-comment').val();
- var tasting = $(" input[type='radio']:checked").val();
- var date = $('#tasting-date-select').find(':selected').data('date');
- $('#tasting-comment').empty();
- $.ajax({
- url: url,
- method: 'POST',
- data: {
- _token: token,
- turn: turn_id,
- tasting: tasting,
- comment: comment,
- date: date
- },
- success: function (data) {
- $('#degustacion').modal('hide');
- },
- error: function (data) {
- if (data.status === 422) {
- for (var item in data.responseJSON) {
- if (data.responseJSON.hasOwnProperty(item)) {
- data.responseJSON[item].forEach(function (t) {
- var li = document.createElement('li');
- li.appendChild(document.createTextNode(t));
- $('#tastingInputErrorList').append(li);
- })
- }
- }
- $('#tastingInputErrorList').show()
- }
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement