POST-ing XML in AngularJS

后端 未结 2 2016
醉梦人生
醉梦人生 2020-12-20 04:05

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 of

相关标签:
2条回答
  • 2020-12-20 04:40

    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' }
    })
    
    0 讨论(0)
  • 2020-12-20 04:52

    Figured it out. The Content-Type is threw me for a while. Seemed that application/xml made more sense. Oh well, whatever works!

    $http({ 
        method: 'POST',
        url: 'http://10.0.0.123/PHP/itemsGet.php',
        data: '<searchKey id="whatever"/>',
        headers: { "Content-Type": 'application/xml' }
    })
    
    0 讨论(0)
提交回复
热议问题