This is my ajax code:
var param = "<ClientOrder xmlns='http://www.eysnap.com/mPlayer'>";
param += "<ClientId>CRF-1</ClientId>";
param += "<UserKey>598zxc8ddl45a3cvScuk</UserKey>" ;
param += "<PassKey>p1re254l3jd83os00cpk</PassKey>";
param += "<OrderId>123132323435</OrderId>";
param += "</ClientOrder>";
$.ajax({
url: URL,
data: param,
type: 'POST',
contentType: "text/xml",
dataType: "text",
success: function(result){
alert('success');
$("#div1").html(result);
},
error: function (xhr) {
alert('error');
$("#div1").html(xhr.responseText);
}
});
The service I'm calling is restful. The crazy thing is that when I call a GET service, it returns the data correctly, but with POST service it gives this error:
XMLHttpRequest cannot load [url]. Response for preflight has invalid HTTP status code 405
Any help will be appreciated.
get
, then you have to comply. It may not be REST compliant, but that's the way it is :-) – thstHTTP Error 405 Method not allowed
which means they do not allow POST requests. – Yvo Cilon