JQuery Ajax method: POST not working Windows servers

I was trying to debug a fellow programmers code that was not working. It looked like it was not loading include files that were trying to load using jQuery’s Ajax function. I was only seeing the problem on Windows servers for some reason. I used a very small sample group, but it worked on two different Apache servers and did not work on two different Windows servers.

Specifically, the windows servers were throwing a “405 Method Not Allowed” error when trying to load the include files.

For the Ajax function, the method was set to “POST”. The fix was switching that to “GET”. I’m not sure why that worked, and not sure of the ramifications of using GET over POST, but the in this case none of the data is sensitive, so I don’t think it matters, but I will test more.

$.ajax({
method:"GET",
url:"inc/"+__W+__G+"_header.html",
success:function(dataIn){$("#headerContent").html(dataIn);
$.checkPagesToLoad("header");
}});

It's only fair to share...Tweet about this on TwitterShare on FacebookEmail this to someoneShare on Google+
This entry was posted in AJAX, jQuery, JSON. Bookmark the permalink.