Please tell me, I call the sweetalert window with the support ticket opening form from the button.
function NewTicket(num) { swal({ type: 'warning', title: 'New Ticket', text: '<label for="new-ticket-theme" class="col-form-label">Theme:</label>' +'<input type="text" name="theme" id="new-ticket-theme" style="display:block">' +'<label for="new-ticket-message" class="col-form-label">Message:</label>' +'<textarea name="message" id="new-ticket-message" style="display: block; margin-top: 10px; margin-bottom: 17px; height: 120px;"></textarea>', showCancelButton: true, confirmButtonColor: '#ff5908', cancelButtonColor: '#666', confirmButtonText: 'Open', cancelButtonText: 'Cancel', html:true }, function(isConfirm){ if (isConfirm) { var result = {}; result.theme = $('#new-ticket-theme').val(); result.message = $('#new-ticket-message').val(); $.ajax({ url:"/Support/NewTicket", type: "POST", data: JSON.stringify(result), success: function() { swal({ title: "Done", text: "Your ticket has been opened!", type: "success", showCancelButton: false }, $('button[class="confirm"]').click(function () { setInterval(function () { window.location.replace('/support/ticket/'+num); } , 1000) }) )}, error: function() {swal("Error!", "Please try to contact with us via e-mail.", "error");}, }) } else { swal("Error!", "Please try to contact with us via e-mail.", "error"); } }); } He works out great for me. But there is a misfortune: a check for fullness. If someone came across, tell me who checked it and where did it fill the errors? Is it possible to get any hints for the user or highlighting the fields in the swal form itself when clicking on the confirmation button and how ?! Sorry for this question, but I didn’t begin to get acquainted with AJAX for a long time, and so far I’ve mainly looked at it with examples, but I haven’t found such a guide for sweet alert everywhere very poor.