$.ajax({
type:‘post‘,
url: ‘http://localhost:8085/cart/selectCartShopNum‘,
dataType: ‘json‘,
xhrFields: {
withCredentials: true //解决跨服务传递时不传递cookie的问题,允许携带证书
},
crossDomain: true, //允许跨域
success: function (data) {
console.info(data)
if (data.status == 200){
alert(data.data)
$("#shopping-num").html = data.data
}
}
})
原文:https://www.cnblogs.com/Jansens520/p/14720627.html