I have a code of ajax which is calling WCF service, When I call it through localhost it says 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)
however it takes all parameters with it. When I put the same link as above showing in the snippet in Postman by changing to POST, it works fine.
I have changed this to also POST at localhost issue still exist.
can you change this : contentType: "application/x-www-form-urlencoded"
i got response with this:
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.";
}
}
});
try from ur side