Laravel gannt dhtmlx problem with route


#1

Hi,

I want to use the api Gannt with router web.php

window.onload = function() {
gantt.init(“gantt_workshifts”);
gantt.load("/task/index");
var dp = new gantt.dataProcessor("/task");
dp.init(gantt);
dp.setTransactionMode(“REST”);
}

My problem is that gantt.load("/task/index") works but for put,delete,post i have 419 (unknown status)…
Maybe is because I don t use router api.php?
I try simple ajax call and work

$.ajax({
method: “DELETE”,
headers: {
‘X-CSRF-TOKEN’: $(‘meta[name=“csrf-token”]’).attr(‘content’)
},
contentType: “application/x-www-form-urlencoded”,
url: “/task/1”,
}).done(function( msg ) {
if(msg.error == 0){
//$(’.sucess-status-update’).html(msg.message);
console.log(msg);
}else{
console.log(msg);
//$(’.error-favourite-message’).html(msg.message);
}
});


#2

Hi,
do you have this issue with laravel?
it’s probably related to csrf token value, at least that how it looks like after a quick search
stackoverflow.com/questions/464 … own-status

pls check if you have a following in your blade template:

<meta name="csrf-token" content="{{ csrf_token() }}">

and can you check the value of that tag at the runtime, please execute following in browser console:

$('meta[name="csrf-token"]').attr('content')

does the value look as expected? i.e. not an empty string and not ‘{{ csrf_token() }}’ string


#3

Thanks resolved


#4

I face the same issue when I was doing programming on ignou pgdrd project but now the issue is resolved