1
我想发送一个POST请求到jquery的restful服务,其中发送的数据类型是xml。Jquery POST XML到休息服务
休息服务工作,因为我从Chrome Rest插件测试它。 我使它适用于GET XML,GET JSON和POST JSON,但没有POST XML的方式。
这是代码。我没有得到任何错误,但调用并不成功:
$.ajax({
type: "POST",
url: "http://[...]",
dataType: "xml",
contentType: "application/xml"
data: "<Category><categoryId>007</categoryId><categoryName>Ajax</categoryName></Category>",
success: function (res) {
alert("XML: it works!");
},
error: function (res) {
alert("XML: not working! " + res.statusText);
}
});
是REST式服务上同一个域名? – fmgp