Reactjs 我试图将数据发送到api。在《邮递员》上,它起作用,但它不起作用';不能使用axios

Reactjs 我试图将数据发送到api。在《邮递员》上,它起作用,但它不起作用';不能使用axios,reactjs,axios,Reactjs,Axios,我曾尝试将数据发送到postman上的api,但它在axios上不起作用。我想知道如何在代码中添加标题 var ticket = { road: e.state.road, amount: e.state.amount, day: e.state.day, mon: e.state.mon, pay: e.state.pay, card: e.sta

我曾尝试将数据发送到postman上的api,但它在axios上不起作用。我想知道如何在代码中添加标题

var ticket = {
            road: e.state.road,
            amount: e.state.amount,
            day: e.state.day,
            mon: e.state.mon,
            pay:  e.state.pay,
            card:  e.state.card,
            cvc:  e.state.cvc,
            holdername: e.state.holdername,
            phone: e.state.phone,
            pin:  e.state.pin,
            nic: e.state.nic,
            email: e.state.email,

        }
          axios.post('http://localhost:8080/ticket', ticket).then(function(response) {
            e.setState({
              messageFromServer: response.data
            });
          });

用API检查cors策略,邮递员不会检查cors


示例:对于NodeJS API,axios+react native存在该问题。最终使用默认抓取。您的控制台中是否有任何错误?