Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
- <script type="text/javascript" src="https://momentjs.com/downloads/moment.js"></script>
- <script src="https://js.pusher.com/4.1/pusher.min.js"></script>
- <script>
- // Enable pusher logging - don't include this in production
- Pusher.logToConsole = true;
- var pusher = new Pusher('***', {
- cluster: 'us2'
- });
- var channel = pusher.subscribe('logEventChannel');
- channel.bind('logEvent', function(response) {
- var log = response.data['json'];
- var method = response.data['method'];
- console.log('\x1b[41m%s\x1b[0m',">>>>>>>>>>>>>>>>>>>>>>>>>DBEUG<<<<<<<<<<<<<<<<<<<<<<<<<");
- console.log('\x1b[41m%s\x1b[0m','method');
- console.log(method);
- console.log('\x1b[41m%s\x1b[0m',">>>>>>>>>>>>>>>>>>>>>>>>>DBEUG<<<<<<<<<<<<<<<<<<<<<<<<<");
- console.log("SENT FROM BE", method , log);
- //====================================
- // POST
- //====================================
- if(method == 'POST'){
- var type = log.type;
- var id = log.id;
- var babyId = log.babyId;
- var updatedAt = log.updated_at;
- var timeAgo = moment(updatedAt).fromNow();
- var time = moment(updatedAt).format('hh:mm a');
- getLogMessages(type);
- getCount(type);
- shake('.badge-'+type,1);
- if(type == 'feed'){
- logAudit(babyId);
- blink(".timeLeft");
- blink(".nextFeed");
- }
- var row = `<tr id="tr-${id}" data-type="${type}"> <td > <a class="btn btn-${type}" > <img class="logIconSmall" src="/assets/be/img/baby/${type}.png"/> </a> </td> <td> <a onclick="showModal('${time}','${type}','${id}')" class="btn btn-link"> ${time} </a> </td> <td></td> </tr>`;
- $('.tbody-log').prepend(row);
- blink("#tr-"+id);
- }
- //====================================
- // PUT
- //====================================
- if(method == 'PUT'){
- var type = log.type;
- var id = log.id;
- var babyId = log.babyId;
- var updatedAt = log.updated_at;
- var timeAgo = moment(updatedAt).fromNow();
- var time = moment(updatedAt).format('hh:mm a');
- getLogMessages(type);
- getCount(type);
- shake('.badge-'+type,1);
- if(type == 'feed'){
- logAudit(babyId);
- blink(".timeLeft");
- blink(".nextFeed");
- }
- $("#tr-"+id).remove();
- var row = `<tr id="tr-${id}" data-type="${type}"> <td > <a class="btn btn-${type}" > <img class="logIconSmall" src="/assets/be/img/baby/${type}.png"/> </a> </td> <td> <a onclick="showModal('${time}','${type}','${id}')" class="btn btn-link"> ${time} </a> </td> <td></td> </tr>`;
- $('.tbody-log').prepend(row);
- blink("#tr-"+id);
- }
- //====================================
- // DELETE
- //====================================
- if(method == 'DELETE'){
- var id = log.logId;
- var type = log.type;
- var babyId = log.babyId;
- if(type == 'feed'){
- logAudit(babyId);
- blink(".timeLeft");
- blink(".nextFeed");
- }
- getLogMessages(type);
- getCount(type);
- shake('.badge-'+type,1);
- blink("#tr-"+id);
- $("#tr-"+id)
- .animate({ backgroundColor: "#ef004810" }, 500 )
- .animate({ backgroundColor: "black"}, 500 )
- .fadeOut(100);
- }
- audit(babyId, id, type, method);
- getNextFeed(babyId);
- });
- </script>
- {{-- Mobile Vs. Desktop --}}
- @if($is_mobile)
- @include('layouts.be.baby.scripts.swipe')
- @else
- <script src="/assets/be/js/snowflakeCursor.js"></script>
- @endif
- {{-- Audio --}}
- <audio id="audio-poop" src="http://www.soundjay.com/button/beep-07.wav" autostart="false" ></audio>
- <audio id="audio-pee" src="http://www.soundjay.com/button/beep-02.wav" autostart="false" ></audio>
- <audio id="audio-feed" src="http://www.soundjay.com/button/beep-03.wav" autostart="false" ></audio>
- <audio id="audio-medicine" src="http://www.soundjay.com/button/beep-04.wav" autostart="false" ></audio>
- <audio id="audio-cry" src="http://www.soundjay.com/button/beep-05.wav" autostart="false" ></audio>
- <script type="text/javascript">
- function playSound(sound) {
- var sound = document.getElementById("audio-"+sound);
- sound.play();
- }
- </script>
- <script type="text/javascript">
- function shake(select, seconds) {
- // $(select).effect('shake', {
- // times: 4
- // }, seconds*1000);
- $(select).effect( "shake", { direction: "up", times: 4, distance: 10}, seconds*1000);
- }
- function blink(select, seconds) {
- $(select).fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(100);
- }
- function checkTime(i) {
- if (i < 10) {i = "0" + i};
- return i;
- }
- function timeDiffCalc(dateFuture, dateNow) {
- let diffInMilliSeconds = Math.abs(dateFuture - dateNow) / 1000;
- // console.log(dateFuture,dateNow);
- const days = Math.floor(diffInMilliSeconds / 86400);
- diffInMilliSeconds -= days * 86400;
- // console.log('calculated days', days);
- const hours = Math.floor(diffInMilliSeconds / 3600) % 24;
- diffInMilliSeconds -= hours * 3600;
- // console.log('calculated hours', hours);
- const minutes = Math.floor(diffInMilliSeconds / 60) % 60;
- diffInMilliSeconds -= minutes * 60;
- // console.log('minutes', minutes);
- let difference = '';
- if (days > 0) {
- difference += (days === 1) ? `${days} day, ` : `${days} days, `;
- }
- difference += (hours === 0 || hours === 1) ? `${hours}h ` : `${hours}h `;
- difference += (minutes === 0 || hours === 1) ? `${minutes}m` : `${minutes}m`;
- return difference;
- }
- function refreshThePage(seconds) {
- window.setTimeout(function () {
- window.location.reload();
- }, 1000 * seconds);
- }
- var url_string = window.location.href;
- var url = new URL(url_string);
- var dateParam = url.searchParams.get("date");
- var codeParam = url.searchParams.get("code");
- /*================================
- = TimeLeft =
- ================================*/
- var nextFeedString = '{{ $nextFeed }}';
- nextFeedString = nextFeedString.replace(' ', 'T');
- var timeLeft = timeDiffCalc(new Date(nextFeedString), new Date());
- var date = moment().format('YYYY-MM-DD');
- // CLOCK Vs. NO CLOCK
- if(dateParam == null || dateParam == date) {
- //setInterval($('#clock').html(moment().format('ddd M/d/y H:mm:ss')), 1000);
- window.setInterval(function () {
- $('#clock').html(moment().format('ddd MM/DD/y H:mm:ss'))
- }, 1000);
- timeLeftRender(nextFeedString);
- } else {
- //NO CLOCK
- var date = dateParam;
- $('#clock').text(moment(date).format('ddd MM/DD/y'));
- $("#profileIcon").css("border", "4px solid #fff");
- $("#clock").css("color", "#fff");
- $("pre").css("border", "2px solid #fff");
- }
- //====================================
- // Profile + Age
- //====================================
- $("#norden, #age").click(function() {
- console.log("norden clicked");
- var win = window.open('https://www.youtube.com/watch?v=jYHdPf_IZqc&ab_channel=Lan_LanSubs', '_blank');
- if (win) {
- win.focus();
- } else {
- alert('Please allow popups for this website');
- }
- });
- //====================================
- // Desktop
- //====================================
- if ($(window).width() > 600) {
- //====================================
- // displayMode
- //====================================
- if(`{{$baby->displayMode}}` < 4){
- $('.rightSection, #profileIcon, #norden, #age, #logNote, .slidingText, #babyNameDesktop').remove();
- $('.leftSection').toggleClass('col-md-9');
- $('.leftSection').css('background-image',"url()");
- $(".nextFeed").css("font-size", "270px");
- $(".timeLeft").css("border-bottom", "none");
- $(".badge").css("font-size", "40px");
- if(`{{$baby->displayMode}}` == 3){
- $("#profileIcon, #norden").mouseenter(function() {
- $("#profileIcon").css("cursor", "url(https://i.imgur.com/T2QWx7Z.png), auto ");
- });
- $('.leftSection').css('background-image',"url({{$baby->babyBgPath}})");
- }
- } else {
- $("#profileIcon, #norden").mouseenter(function() {
- $("#profileIcon").css("cursor", "url(https://i.imgur.com/T2QWx7Z.png), auto ");
- });
- $('.leftSection').css('background-image',"url({{$baby->babyBgPath}})");
- }
- $('.leftSection').css('height', $(window).height());
- $('.rightSection').css('height', $(window).height());
- $("body").css("overflow", "hidden");
- $(".adminLink, .readOnlyLink").show();
- // refreshThePage(30);
- //snowFlare
- new snowflakeCursor({ element: document.querySelector(".leftSection") });
- } else {
- //====================================
- // Mobile
- //====================================
- $(".adminLink, .readOnlyLink").hide();
- }
- //====================================
- // Note
- //====================================
- $("#toggleNoteModal").hide();
- $("#logNote").click(function() {
- $("#toggleNoteModal").click();
- });
- //====================================
- // Interval
- //====================================
- $(".previous").click(function() {
- var selectedDay = moment(date).subtract(Math.abs(1), 'days').format('YYYY-MM-DD');
- console.log("previous");
- console.log('selectedDay', selectedDay);
- console.log('date',date);
- document.location = window.location.origin + window.location.pathname + '?code={{$baby->readOnlyCode}}&date=' + selectedDay;
- });
- $(".next").click(function() {
- if(date != moment().format('YYYY-MM-DD')) {
- var selectedDay = moment(date).add(1, 'days').format('YYYY-MM-DD');
- console.log("next");
- console.log('selectedDay', selectedDay);
- console.log('date',date);
- document.location = window.location.origin + window.location.pathname + '?code={{$baby->readOnlyCode}}&date=' + selectedDay;
- } else {
- console.log("future");
- }
- });
- //====================================
- // ReadOnly
- //====================================
- if(codeParam == '{{ $baby->readOnlyCode }}' ) {
- $("a.btn, .btn-link, #logNote").click(function() {
- return false;
- });
- }
- $(document).on('show.bs.modal', '#note', function (e) {
- console.log('works');
- $("body, html").css("overflow", "hidden");
- window.onbeforeunload = function() {
- return false;
- }
- });
- //====================================
- // TR Hover
- //====================================
- $("tr").mouseenter(function() {
- var row = $(this).attr("data-type");
- //RESET
- $('tr').css("border-top", "0");
- $('tr').css("border-bottom", "0");
- $('tr').css("box-shadow", "none");
- //SET
- if(row == 'pee'){
- $(this).css("border-top", "2px solid #46b8da");
- $(this).css("border-bottom", "2px solid #46b8da");
- $(this).css("box-shadow", "0px 0px 200px 2px #46b8da");
- $(this).css("-moz-box-shadow", "0px 0px 200px 2px #46b8da");
- $(this).css("-webkit-box-shadow", "0px 0px 200px 2px #46b8da");
- }
- if(row == 'poop'){
- $(this).css("border-top", "2px solid #ffb54c");
- $(this).css("border-bottom", "2px solid #ffb54c");
- $(this).css("box-shadow", "0px 0px 200px 2px #ffb54c");
- $(this).css("-moz-box-shadow", "0px 0px 200px 2px #ffb54c");
- $(this).css("-webkit-box-shadow", "0px 0px 200px 2px #ffb54c");
- }
- if(row == 'feed'){
- $(this).css("border-top", "2px solid #fff");
- $(this).css("border-bottom", "2px solid #fff");
- $(this).css("box-shadow", "0px 0px 200px 2px #fff");
- $(this).css("-moz-box-shadow", "0px 0px 200px 2px #fff");
- $(this).css("-webkit-box-shadow", "0px 0px 200px 2px #fff");
- }
- if(row == 'medicine'){
- $(this).css("border-top", "2px solid #e6ff00");
- $(this).css("border-bottom", "2px solid #e6ff00");
- $(this).css("box-shadow", "0px 0px 200px 2px #e6ff00");
- $(this).css("-moz-box-shadow", "0px 0px 200px 2px #e6ff00");
- $(this).css("-webkit-box-shadow", "0px 0px 200px 2px #e6ff00");
- }
- });
- //====================================
- // countType
- //====================================
- function getCount(type) {
- var data = {};
- data.babyId = '{{ $baby->id }}';
- data.type = type;
- data.date = date;
- $.ajax({
- method: 'POST',
- url: '/baby/countType',
- crossDomain: true,
- contentType: false,
- headers: {
- 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('value'),
- "Accept": "application/json",
- "Content-Type": "application/x-www-form-urlencoded",
- "Cache-Control": "no-cache"
- },
- data: data,
- success: function(response){
- // console.log(response);
- $('.count-'+data.type).text(response);
- },
- error: function(jqXHR, textStatus, errorThrown) {
- console.log(JSON.stringify(jqXHR));
- console.log("AJAX error: " + textStatus + ' : ' + errorThrown);
- }
- });
- }
- getCount('poop');
- getCount('pee');
- getCount('medicine');
- getCount('feed');
- //====================================
- // Log Create
- //====================================
- $('.logButtons a').on('click', function (e){
- e.preventDefault();
- var data = {};
- data.method = 'POST';
- data.babyId = '{{ $baby->id }}';
- data.type = $(this).attr("data-type");
- data.date = date;
- console.log('SENT from FE',data);
- // return false;
- $.ajax({
- method: 'POST',
- url: '/baby/log',
- crossDomain: true,
- contentType: false,
- headers: {
- 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('value'),
- "Accept": "application/json",
- "Content-Type": "application/x-www-form-urlencoded",
- "Cache-Control": "no-cache"
- },
- data: data,
- success: function(response){
- getCount(data.type);
- },
- error: function(jqXHR, textStatus, errorThrown) {
- console.log(JSON.stringify(jqXHR));
- console.log("AJAX error: " + textStatus + ' : ' + errorThrown);
- }
- });
- });
- //====================================
- // Log Create
- //====================================
- function updateLog(logId) {
- var data = {};
- data.method = 'PUT';
- data.babyId = '{{ $baby->id }}';
- data.logId = logId;
- data.date = date;
- data.updatedAt = $("input[name=updatedAt]").val();
- console.log('SENT from FE',data);
- $.ajax({
- method: 'PUT',
- url: '/baby/log',
- crossDomain: true,
- contentType: false,
- headers: {
- 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('value'),
- "Accept": "application/json",
- "Content-Type": "application/x-www-form-urlencoded",
- "Cache-Control": "no-cache"
- },
- data: data,
- success: function(response){
- $('.modal').modal('hide');
- },
- error: function(jqXHR, textStatus, errorThrown) {
- console.log(JSON.stringify(jqXHR));
- console.log("AJAX error: " + textStatus + ' : ' + errorThrown);
- }
- });
- };
- //====================================
- // Log Delete
- //====================================
- function deleteLog(logId, type) {
- var data = {};
- data.method = 'DELETE';
- data.babyId = '{{ $baby->id }}';
- data.logId = logId;
- data.date = date;
- data.type = type;
- console.log('SENT from FE',data);
- $.ajax({
- method: 'DELETE',
- url: '/baby/log',
- crossDomain: true,
- contentType: false,
- headers: {
- 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('value'),
- "Accept": "application/json",
- "Content-Type": "application/x-www-form-urlencoded",
- "Cache-Control": "no-cache"
- },
- data: data,
- success: function(response){
- $('.modal').modal('hide');
- },
- error: function(jqXHR, textStatus, errorThrown) {
- console.log(JSON.stringify(jqXHR));
- console.log("AJAX error: " + textStatus + ' : ' + errorThrown);
- }
- });
- }
- //====================================
- // logDetail
- //====================================
- function getLogMessages(type) {
- var data = {};
- data.babyId = '{{ $baby->id }}';
- data.type = type;
- data.date = date;
- $.ajax({
- method: 'POST',
- url: '/baby/logDetail',
- crossDomain: true,
- contentType: false,
- headers: {
- 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('value'),
- "Accept": "application/json",
- "Content-Type": "application/x-www-form-urlencoded",
- "Cache-Control": "no-cache"
- },
- data: data,
- success: function(response){
- // console.log(response);
- // console.log("data.type",data.type);
- var lastFeedMessage = '';
- var lastFeedColor = '';
- for (i = 0; i < response.length; i++) {
- // console.log(response[i].id);
- if(data.type == 'feed'){
- if(response[i].msg.includes("+")){
- var color = '#00ff5c';
- } else {
- var color = '#ef0048';
- }
- lastFeedMessage = response[0].msg;
- if(lastFeedMessage.includes("+")){
- var lastFeedColor = '#00ff5c';
- } else {
- var lastFeedColor = '#ef0048';
- }
- } else {
- var color = '#ccc';
- }
- $('#td-'+response[i].id).html('');
- var td = `<span style="font-weight: bold; color:${color};">${response[i].msg}</span>`;
- $('#td-'+response[i].id).prepend(td);
- }
- if(`{{$baby->displayMode}}` == 1){
- if ($(window).width() > 600) {
- $('.timeLeft').append(`<br><span style="font-weight: bold; font-size:100px; margin-left:10px; color:${lastFeedColor};">${lastFeedMessage}</span>`);
- }
- }
- },
- error: function(jqXHR, textStatus, errorThrown) {
- console.log(JSON.stringify(jqXHR));
- console.log("AJAX error: " + textStatus + ' : ' + errorThrown);
- }
- });
- }
- getLogMessages('feed');
- getLogMessages('poop');
- getLogMessages('pee');
- getLogMessages('medicine');
- //====================================
- // datePicker
- //====================================
- $("#clock").click(function() {
- $("#expiryDate").datepicker({
- dateFormat: 'yy-mm-dd',
- maxDate: 0,
- onSelect: function() {
- var dateSelected = $(this).datepicker('getDate');
- dateSelected = moment(dateSelected).format('YYYY-MM-DD');
- if(dateParam == null) {
- var url = document.location.href+"&date="+dateSelected;
- }else {
- var url = document.location.href;
- url = url.replace(dateParam,dateSelected);
- }
- document.location = url;
- }
- });
- $('#expiryDate').datepicker('show');
- });
- //====================================
- // showForm
- //====================================
- function showModal(val, type, logId ) {
- console.log("val, type, logId",val, type, logId);
- var popupTemplate = `
- <div class="modal fade" data-backdrop="static">
- <div class="model-content" style="margin-top: 200px;">
- <div class="col-sm-offset-4 col-sm-2 col-md-offset-5 col-md-2 text-center">
- <img width="80" src="/assets/be/img/baby/${type}.png"><br><br><br>
- <input type="time" value="${val}" name="updatedAt" width="100%" height="80">
- <br><br>
- <button onclick="updateLog('${logId}')" class="btn btn-success btn-block">Done</button>
- <br>
- <button onclick="deleteLog('${logId}', '${type}')" class="btn btn-danger btn-block">Delete</button>
- </div>
- </div>
- </div>
- `;
- $(popupTemplate).modal();
- }
- //====================================
- // getLog
- //====================================
- function getLog(logId) {
- var data = {};
- console.log('SENT from FE',data);
- $.ajax({
- method: 'POST',
- url: '/baby/log/'+logId,
- crossDomain: true,
- contentType: false,
- headers: {
- 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('value'),
- "Accept": "application/json",
- "Content-Type": "application/x-www-form-urlencoded",
- "Cache-Control": "no-cache"
- },
- data: data,
- success: function(response){
- getCount(data.type);
- var log = response.data['json'];
- var type = log.type;
- var id = log.id;
- var updatedAt = log.updated_at;
- var timeAgo = moment(updatedAt).fromNow();
- var time = moment(updatedAt).format('hh:mm a');
- var row = `<tr data-type="${type}"> <td > <a class="btn btn-${type}" > <img class="logIconSmall" src="/assets/be/img/baby/${type}.png"/> </a> </td> <td>
- <a onclick="showModal('${time}','${type}','${id}')" class="btn btn-link">
- ${time}
- </a>
- </td>
- <td></td>
- </tr>`;
- $('.tbody-log').prepend(row);
- },
- error: function(jqXHR, textStatus, errorThrown) {
- console.log(JSON.stringify(jqXHR));
- console.log("AJAX error: " + textStatus + ' : ' + errorThrown);
- }
- });
- }
- //====================================
- // getNextFeed
- //====================================
- function getNextFeed(babyId) {
- var data = {};
- data.babyId = babyId;
- data.date = date;
- console.log('SENT from FE',data);
- $.ajax({
- method: 'POST',
- url: '/baby/log/nextFeed',
- crossDomain: true,
- contentType: false,
- headers: {
- 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('value'),
- "Accept": "application/json",
- "Content-Type": "application/x-www-form-urlencoded",
- "Cache-Control": "no-cache"
- },
- data: data,
- success: function(response){
- console.log('SUCCESS response',response);
- timeLeftRender(response);
- },
- error: function(jqXHR, textStatus, errorThrown) {
- console.log(JSON.stringify(jqXHR));
- console.log("AJAX error: " + textStatus + ' : ' + errorThrown);
- }
- });
- }
- window.setInterval(function () {
- getNextFeed('{{ $baby->id }}');
- }, 5000);
- //====================================
- // timeLeft
- //====================================
- function timeLeftRender(nextFeedString) {
- nextFeedString = nextFeedString.replace(' ', 'T');
- var timeLeft = timeDiffCalc(new Date(nextFeedString), new Date());
- $('.timeLeft').text('');
- $('.timeLeft').text(timeLeft);
- $('.nextFeed').text('');
- $('.nextFeed').html(moment(nextFeedString).format('h:mm a'));
- if(timeLeft.includes("0h")){
- $(".timeLeft").css("color", "#ffc51b");
- timeLeft = timeLeft.replace('0h', '');
- $('.timeLeft').text(timeLeft);
- if ($(window).width() > 600) {
- $(".timeLeft").css("font-size", "234px");
- } else {
- $(".timeLeft").css("font-size", "25px");
- }
- $("#profileIcon").css("border", "4px solid #ffc51b");
- $("#clock").css("color", "#ffc51b");
- $("pre").css("border", "2px solid #ffc51b");
- }else {
- $(".timeLeft").css("color", "#00ff5c");
- $("#profileIcon").css("border", "4px solid #00ff5c");
- $("#clock").css("color", "#00ff5c");
- $("pre").css("border", "2px solid #00ff5c");
- }
- if(new Date(nextFeedString) < new Date()){
- $(".timeLeft").css("color", "#c12222");
- timeLeft = timeLeft.replace('0h', '');
- $("#profileIcon").css("border", "4px solid #c12222");
- $("#clock").css("color", "#c12222");
- $("pre").css("border", "2px solid #c12222");
- $('.timeLeft').text(timeLeft);
- }else{
- $('.timeLeft').text(timeLeft);
- }
- }
- //====================================
- // Audit
- //====================================
- function logAudit(babyId) {
- var data = {};
- data.babyId = babyId;
- data.date = date;
- console.log('SENT from FE',data);
- $.ajax({
- method: 'POST',
- url: '/baby/log/audit',
- crossDomain: true,
- contentType: false,
- headers: {
- 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('value'),
- "Accept": "application/json",
- "Content-Type": "application/x-www-form-urlencoded",
- "Cache-Control": "no-cache"
- },
- data: data,
- success: function(response){
- console.log('SUCCESS response',response);
- },
- error: function(jqXHR, textStatus, errorThrown) {
- console.log(JSON.stringify(jqXHR));
- console.log("AJAX error: " + textStatus + ' : ' + errorThrown);
- }
- });
- }
- //====================================
- // audit
- //====================================
- function audit(babyId, logId, type, method) {
- var data = {};
- data.babyId = babyId;
- data.logId = logId;
- data.type = type;
- data.method = method;
- console.log('SENT from FE',data);
- $.ajax({
- method: 'POST',
- url: '/baby/audit',
- crossDomain: true,
- contentType: false,
- headers: {
- 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('value'),
- "Accept": "application/json",
- "Content-Type": "application/x-www-form-urlencoded",
- "Cache-Control": "no-cache"
- },
- data: data,
- success: function(response){
- console.log('SUCCESS response',response);
- },
- error: function(jqXHR, textStatus, errorThrown) {
- console.log(JSON.stringify(jqXHR));
- console.log("AJAX error: " + textStatus + ' : ' + errorThrown);
- }
- });
- }
- </script>
Add Comment
Please, Sign In to add comment