jQuery .ajax() POST Request throws 405 (Method Not Allowed) on RESTful WCF

Your code is actually attempting to make a Cross-domain (CORS) request, not an ordinary POST. That is: Modern browsers will only allow Ajax calls to services in the same domain as the HTML page. Example: A page in http://www.example.com/myPage.html can only directly request services that are in http://www.example.com, like http://www.example.com/testservice/etc. If the service is in … Read more

Cannot set content-type to ‘application/json’ in jQuery.ajax

It would seem that removing http:// from the URL option ensures the the correct HTTP POST header is sent. I don’t think you need to fully qualify the name of the host, just use a relative URL as below. $.ajax({ type: “POST”, contentType: “application/json”, url: ‘/Hello’, data: { name: ‘norm’ }, dataType: “json” }); An … Read more

Can we create custom HTTP Status codes?

Yes, as long as you respect the class — that is, 2xx for success, 4xx for Client error, etc. So you can return custom 4XX error codes (preferably those that are unassigned) for your own application’s error conditions. To quote from [RFC 2616][1]: “HTTP status codes are extensible. HTTP applications are not required to understand … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)