Below code is in my website:
function validateRequest() {
var $form = $('form');
if ($form.valid()) {
$.support.cors = true;
var lnkey = $('#txtloan').val();
var psw = $('#txtpsw').val();
var loanServiceUrl = @Html.Raw(Json.Encode(ConfigurationManager.AppSettings["LoanServiceURL"]));
var msg = {"loan": lnkey, "psw": psw};
$.ajax({
cache: false,
async: true,
type: "POST",
url: loanServiceUrl + "ValidateRequest",
data: JSON.stringify(msg),
contentType: "application/json; charset=utf-8",
dataType: "json", //jsonp?
success: function (response) {
$(response).each(function(i, item) {
if (item.Validated.toString().toUpperCase() == 'TRUE') {
// When validation passed
$('#divResult').load('@Url.Action("GetLoanInfo", "Validate")');
$("#btnClearStatus").show();
$('#btnGetStatus').hide();
}
});
},
error: function (errormsg) {
alert("ERROR! \n" + JSON.stringify(errormsg));
}
});
}
}
I have set following setting in IIS where my service is deployed.
When I make a POST call from website, I see two calls (probably one is pre-flight call for CORS) in fiddler. This is working fine in chrome and Safari but not in Firefox. I get HTTP 405 error. I am using Firefox 21.0.
Below is the snap shot from fiddler when service is called from firefox.