Can anyone tell me what I am doing wrong in the below code. I want to Ajax an xml (either text/xml or application/xml) into my REST service (same app server).
When doing that I am getting error code 400 Bad Request.
$.ajax({ type: 'POST',
url: '<url>',
data: '<?xml version="1.0" encoding="UTF-8"?><test>Hello World</test>',
contentType: 'text/xml',
dataType: 'xml',
processData: false,
cache: false,
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status +' '+thrownError);
},
success: function(xml) {
alert('it works: '+xml);
}
});
Any help would be much appreciated.