I am facing a problem that my graph (Using AJAX - POST - PHP) is not appearing on Amazon
http://cdpmotest.s3-website.eu-central-1.amazonaws.com/
its says (Wrong Method 405 Error)
This is my CORS Config :
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>HEAD</AllowedMethod>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>DELETE</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
And this is my Script:
<script>
$(document).ready(function(){
var randomScalingFactor = function(){ return Math.round(Math.random()*100)};
$.ajax({
url: 'graph-data.php',
type: 'POST',
dataType: 'json',
success: function(data) {
var array1 = data.map(function(item) {
return parseInt(item[1], 10);
});
var array2 = data.map(function(item) {
return parseInt(item[2], 10);
});
createGraph(array1, array2);
}
});//end AJAX request
function createGraph(array1, array2) {
var ctx = document.getElementById("chart-area1").getContext("2d");
var barChartData = {
labels : ["Land Acquisition","Design Concept","Permits and Licensing","Tendering","Elec.+Water Requests","Construction Start","Construction Finish","Site Handover"],
datasets : [
{
fillColor : "rgba(0,154,166,0.5)",
strokeColor : "rgba(0,154,166,0.8)",
highlightFill: "rgba(0,154,166,0.75)",
highlightStroke: "rgba(0,154,166,1)",
data : array1
},
{
fillColor : "rgba(77,79,83,0.5)",
strokeColor : "rgba(77,79,83,0.8)",
highlightFill : "rgba(77,79,83,0.75)",
highlightStroke : "rgba(77,79,83,1)",
data : array2
}
]
}//end bar chart data
window.myBar = new Chart(ctx).Bar(barChartData, {
responsive : true
});
}//end createGraph
});
</script>
Its working fine on localhost (WAMPServer)
Can you help me please?
See Question&Answers more detail:
os