Vue.js前端
<script src="__ROOT__/static/i/js/jquery-1.8.3.min.js"></script>
<script src="__ROOT__/static/i/js/app.js"></script>
<script src="__ROOT__/static/vue/unpkg.com/vue.js"></script>
<script src="__ROOT__/static/vue/vant@2.9/lib/vant.min.js"></script>
<script src="__ROOT__/static/vue/unpkg.com/vue-router.js"></script>
<script src="__ROOT__/static/vue/unpkg.com/axios.min.js"></script>
<script src="__ROOT__/static/vue/qs/6.5.1/qs.min.js"></script>
<script>
const qs = Qs
var id=[3,1,2]
var data = {
id: id,
}
console.log(id);
axios.post('../Cart/cart_delete', qs.stringify(data,{arrayFormat: 'indices'}))
.then( res =>{
console.log(res);
console.log(res.data);
console.log(JSON.stringify(res.data));
})
</script>
Thinkphp5.0.1后端
public function cart_delete(){
$id=$_POST['id'];
return json($id);
}
|