I have a really weird problem, I use AJAX to send an email from my html page, which links to a PHP page I have within the SAME website. The AJAX request works fine when I enter the website in IP mode 1xx.xx.xxx.xxx:8080/mywebsite
only when I use a DNS that links to this IP address I get this error :
POST http://www.mywebsite.ma/sendEmail.php 405 (Method Not Allowed)
Here's the AJAX request :
$.ajax({
type: "POST",
url: "sendEmail.php",
data: datastr,
cache: false,
success: function(html){
if (html == "success"){
celebrateTheSuccessOfThisEmailSending();
} else {
killMySelf();
}
},
error: function() {
sumTingWong();
}
});
I finally found the problem, I don't know how I didn't see due to my lack of experience with Servers and stuff. Long story short : I installed Wamp on the server, I used the IP+Port to access it, but when I use the DNS it directly points to the website files(including php files) and it didn't go through Wamp.
I ended up uninstalling Wamp and including PHP in my IIS server to directly compile PHP files without the need to install another server.
I followed this tutorial -> How to Install PHP on IIS 7 for Windows Server 2008