在AngularJS中发布XML [英] POST-ing XML in AngularJS

查看:134
本文介绍了在AngularJS中发布XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找一些 angularjs 文档来解释如何使用 $ http 对象。 angular只是不提供它们的 $ http 对象吗?代码:

I've been looking for hours for some angularjs documentation that explains how to POST xml data using the $http object. Does angular simply not offer it with their $http object? The code:

$http({ 
  method: 'POST',
  url: 'http://10.0.0.123/PHP/itemsGet.php',
  data: '<searchKey id="whatever"/>',
  headers: { "Content-Type": 'application/x-www-form-urlencoded' }
})


推荐答案

我来到这里寻找同样的事情,但是我尝试了Skyler的解决方案而且没有用。
我将内容类型更改为'application / xml'并且它有效。
以下是片段:

I came here looking for the same thing, however I tried Skyler's solution and it did not work. I changed the content type to 'application/xml' and it worked. Here is the snippet:

$http({ 
    method: 'POST',
    url: 'http://10.0.0.123/PHP/itemsGet.php',
    data: '<searchKey id="whatever"/>',
    headers: { "Content-Type": 'application/xml' }
})

这篇关于在AngularJS中发布XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆