I have this code:
$.ajax({
url: '{{ route('frontend.validation') }}?sex=' + $(".sex").val() + '&date=' + $(".date").val() + '&hour=' + $(".hour").val()+ '&track=' + $(".track").val(),
type: 'get',
dataType: 'json',
headers: {
'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
},
cache: false,
success: function (response) {
$.each(response, function (key, value) {
console.log(response);
})
}
});
In result I have:
{"status":"ok","message":"Twoja rezerwacja zosta\u0142a zrealizowana"}
in console I have:
[Log] {status: "ok", message: "Twoja rezerwacja została zrealizowana"} (projekt1.test, line 284) [Log] {status: "ok", message: "Twoja rezerwacja została zrealizowana"} (projekt1.test, line 284)
I need check my status. If it's "ok" - then message I want show in alert box.
When status = "error" them I want show alert with "Sorry, we have error with yours reservation".
How can I make it?