Pavi
Pavi

Reputation: 1739

jQuery.post() returning 405 error on IIS server

I am using a simple jquery post request to read an HTML file from the server. The file exists and is directly accessible through the URL. It also works on my Linux server, but doesn't on my client's Windows server. Any clue as of why this is happening? If it is a server setting, as in requiring additional headers, how would I correct it?

The code:

$.post('/ajax/about.html', function(data){
  $('.container').html(data);
});

The result as seen on Chrome's console:

Failed to load resource: the server responded with a status of 405 (Method Not Allowed) http://example.com/ajax/about.html

But the file 'http://example.com/ajax/about.html' loads if typed directly into the address bar. (example.com is just a fake address used as an example, so it won't work)

Upvotes: 0

Views: 537

Answers (1)

PeteH
PeteH

Reputation: 79

A 405 is "Method not allowed" so I don't think the server is handling the post. To get a static resource, use GET.

Upvotes: 1

Related Questions