使用CORS的jquery,如何使用CORS提交jquery

时间:2017-01-24 18:44:56

标签: jquery cors

jQuery.ajax({                                    
            url: "https://SomeWallet/payment-requests/",
            type: "POST",
            dataType: "json",
            headers: { "Content-Type": "application/x-www-form-urlencoded",
                        "X-Api-Key": "XXXX",
                       "X-Auth-Token": "XXXX", 
                       "Access-Control-Allow-Origin": "*",
                       "Access-Control-Request-Headers":"x-requested-with"
            }, 
            crossDomain: true, 
            data: {
                "some": "sum",
                "buyer_name": "mike",
                "purpose": "iphone7",
                "redirect_url": "https://www.onlineshopping.com",
                "phone": "12345",
                "email": "foo@example.com"
                },
            success: function(data) {                               
                console.info(data);
                }
            });     
    },

我收到以下错误:

XMLHttpRequest无法加载https://SomeWallet/payment-requests/。预检的响应具有无效的HTTP状态代码401

0 个答案:

没有答案