I'm facing a problem to get return value (content-type: "text/xml"). I'm able to get return value by direct access this URL:
https://[domain_name]/myfolder/myapi/?xml=<xml version='1.0'><MyTasks><Search></Search></MyTasks>
Please help me to correct these alternatives if it is wrong (called in HTML located in MyFolder
) because it always alert 'Failed'.
$.ajax({
type : "GET",
url : "interface/?xml=<xml version='1.0'><MyTasks><Search></Search></MyTasks>",
dataType : "text/xml",
success : function(msg){
alert('Success');
}
error : function(msg) {
alert('Failed');
}
});
or...
$.ajax({
type : "POST",
url : "interface/",
data : { xml: escape("<MyTasks><Search></Search></MyTasks>") },
dataType : "text/xml",
success : function(msg){
alert('Success');
}
error : function(msg) {
alert('Failed');
}
});
Thank you.
SOLUTION
The interface has to be accessed by https
, so I changed url
param to absolute URL. I also have to use "xml"
not "text/xml"
as its dataType
. It results Success, thank you.