我将路线设置为"Route::patch('/task/updateStatus/{id}', 'TaskController@saveStatusUpdate');"
,然后在提取时将网址设置为"/task/updateStatus/{id}"
。显示“ 419 (unknown status)"
。我也尝试通过fetch("/task/saveStatusUpdate/" + id)
连接ID。但是在控制台中,它显示ID未定义。
这是我的fetch()代码:
function drop(ev){
ev.preventDefault();
let taskCard = document.getElementById(ev.target.id);
var targetElement = document.getElementById(ev.srcElement.id);
var dropTarget = targetElement.getAttribute("data-match");
console.log("ev.srcElement.id =", ev.srcElement.id);
let valueDrop = targetElement.getAttribute("value");
taskCard.setAttribute("value", valueDrop);
let gotTheValue = taskCard.getAttribute("value");
console.log("the value now of the card " + gotTheValue);
console.log(taskCard);
if(droppedElementId == dropTarget){
// console.log("cardValue=" + )
console.log("dropTarget=" + dropTarget);
console.log("droppedElementId=" + droppedElementId);
// alert("dropTarget =" + dropTarget);
};
var data=ev.dataTransfer.getData("Text");
ev.target.appendChild(document.getElementById(data));
let urlUpdate = "/task/saveStatusUpdate/{id}";
// use of fetch
fetch(urlUpdate, {
method: 'PATCH',
headers: {
'X-CSRF-TOKEN': $('meta[name-csrf="csrf-token"]').attr('content')
},
body: JSON.stringify({
"status_id": gotTheValue
})
})
.then(response => response.json())
.then(console.log)
}
然后这是我的web.php代码
Route::patch('/task/saveStatusUpdate/{id}', 'TaskController@saveStatusUpdate');
我希望一旦放下卡,它就会更改数据库中status_id的值。但有一个错误提示"flexi.js:45 PATCH http://localhost:8000/task/saveStatusUpdate/%7Bid%7D 419 (unknown status)" and "Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0"
答案 0 :(得分:-1)
问题
val progressBar = ProgressDialog(context)
progressBar.setCancelable(false)
progressBar.show()
web_container.webViewClient = object : WebViewClient() {
override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
view.loadUrl(url)
progressBar.show()
return true
}
override fun onPageCommitVisible(view: WebView?, url: String?) {
super.onPageCommitVisible(view, url)
progressBar.dismiss()
}
}
应该是
Database system was intrupted ; last known up at (dateTime)
Database system was not properly shutdown; automatic recovery in progress
Record with zero length at 0/C9B92168
Redo is not required
使用ES6时 并且未定义ID,因为您没有处理要发送的任何ID 可能是taskCard
答案 1 :(得分:-1)
您要传递字符串
let urlUpdate = "/task/saveStatusUpdate/{id}";
应该使用ES6或更高版本
let urlUpdate = `/task/saveStatusUpdate/${id}`;