javascript - 如何在 js 上将来自 sweetalert2 的数据发送到 mysql?
问题描述
async function order(id){
const { value: portion, isConfirmed, isDismissed } = await Swal.fire({
title: 'Are you sure you want to order ' + id,
text: 'When you press the order button, it will be processed.',
icon: 'warning',
showCancelButton: true,
cancelButtonColor: '#d33',
confirmButtonColor: '#3bc42b',
cancelButtonText: 'Cancel',
confirmButtonText: 'Order!',
reverseButtons: true,
input: 'number',
inputLabel: 'Portion number: \n ',
inputPlaceholder: 'Enter portion',
inputAttributes: {
min: 1,
max: 20,
step: 1
},
inputValue: 1,
})
if (isConfirmed) {
Swal.fire({
title: 'Your order has been taken!',
text: `${portion} portion ` + id + ' order is being prepared...',
icon: 'success',
confirmButtonText: 'OK!'
})
console.log(portion + "x " + id)
} else if (isDismissed)
Swal.fire({
title: 'Your order has been abandoned!',
text: 'Your' + id + 'order has been abandoned!',
icon: 'error',
confirmButtonText: 'OK!'
})
}
我想将数据发送到console.log所在的mysql。我该怎么做?我搜索但找不到任何东西。我不知道该怎么做...谢谢那些帮助过的人。
解决方案
推荐阅读
- reactjs - 组件被卸载并在 DOM 中的不同位置渲染它时调用构造函数
- push-notification - iOS 应用程序在重新连接到互联网时停止接收通知
- html - VueJS 导航栏链接只有在浏览器中缩小后才能点击
- python - 使用 for in 循环时将项目移动到列表的前面
- reactjs - 如何使组件在他们接受的道具中明确?
- azure - Nginx拒绝ssh,锁在外面
- scala - 面临错误“无法加载 PDF 文档”。在scala中发送pdf文件作为字节数组作为响应(scala)
- xcode - 我可以摆脱签名部分吗?(沙盒与强化运行时)
- python - 如何从图像字段中删除/替换文件
- python - Jupyter笔记本不显示图表..(只是图表)