I am facing an issue with my service method which is showing errors in multiple browsers including Internet Explorer 8, Chrome, and Firefox 8.0.1.
The error message is:
OPTIONS http://abc/AddRating 405 (Method Not Allowed)
Interestingly, the service method works fine in Chrome and IE 8 but encounters issues in Firefox Mozilla as shown in the Firebug network responses below:
Response Headers view source
Allow POST
Content-Length 1565
Content-Type text/html; charset=UTF-8
Server Microsoft-IIS/7.5
X-Powered-By ASP.NET
Access-Control-Allow-Orig... *
Access-Control-Allow-Meth... POST, GET
Access-Control-Allow-Head... Origin, Content-Type, Accept
Date Wed, 23 Nov 2011 06:34:56 GMT
Request Headersview source
Host services.farooq.tv
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0.1) Gecko/20100101 Firefox/8.0.1
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip, deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection keep-alive
Origin http://localhost:7844
Access-Control-Request-Me... POST
Access-Control-Request-He... content-type
Pragma no-cache
Cache-Control no-cache
This is how the code for the function looks like:
function addService(comments) {
try {
// User details
var user = { "Id": 2007, "FirstName": "Ufone", "LastName": "", "EmailAddress": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1a7b72777f7e347b76735a6c737e73607775347975772f2a23">[email protected]</a>" };
// Other code related to rating information...
$.ajax({
type: "POST",
url: url,
data: JSON.stringify(ratingInfo),
contentType: "application/json",
timeout: 5000,
success: function (success) {
if (success == true) {
$("#addCommentsTable").hide();
// Handling success scenario
}
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr);
}
});
}
catch (err) {
alert(err);
}
}
If anyone can provide assistance, it would be greatly appreciated. Thank you!