报 XMLHttpRequest cannot load http://example.com/v1/recharge. Request header field Access-Control-Allow-Origin is not allowed by Access-Control-Allow-Headers in preflight response.下面这个却可以, var data = { 'operator': {'user_id': '4320-9962-1b83f8fc4264', 'user_name': '乱石铺街'}, 'amount': 1, 'recharge_amount': 2, 'currency': 'SGD', 'user': {'user_id': '4b92-ad75-506590099de5', 'user_name': 'ssdss'} }; $.ajax({ url: 'example.com/v1/recharge', method: 'POST', dataType: 'json', headers:{'Content-Type': 'application/json'}, data: JSON.stringify(data), success: function (data) { alert(JSON.stringify(data)); } });
添加回答
举报
0/150
提交
取消