2016-08-19 40 views
1

我有一个调用WCF服务的ajax代码,当我通过本地主机调用它时,它说Failed to load resource:http://servicelink?order%5B0%5D%5BCoupanId%5D=1&order%5B0%5D%5BDiscount%5D=1&order%5B0%5D%5BEmailAddress%5D=em.com&order%5B0%5D%5ailtemName%5D=Sgfa+wraps&order%5B0%5D%5BItem_Id%5D=1&order%5B0%5D%5BQty%5D=1&order%5B0%5D%5Bprice%5D=5.5 the server responded with a status of 405 (Method Not Allowed) 但是它带有所有参数。当我通过更改为POST将与上述相同的链接显示在Postman的代码片段中时,它可以正常工作。 我已经改变这个也在本地主机问题POST仍然存在。使用邮递员但不在本地主机的代码工作Ajax

+0

其405响应右

jQuery.support.cors = true; $.ajax({ url: "http://service link", type: "POST", dataType: "json", contentType: "application/x-www-form-urlencoded", // data: { order: orderData }, success: function (response) { alert(response.OrderPlacementResult); // orderId = data; if (data != null) { orderStatus = "Order has been placed successfully."; } } }); 

尝试。你有没有给你的邮递员提供任何验证或令牌? – Rigin

+0

是它的405.'没有Auth'与邮递员 – Mangrio

+0

检查标题? – Rigin

回答

1

你可以改变这一点:contentType: "application/x-www-form-urlencoded"

我得到回应该:从乌拉圭回合侧

+0

知道了它的好友。无论如何Thankx – Mangrio

+0

好。我在聊天中失去了你 – Rigin

相关问题