如何使用Javascript发布RSS
问题描述:
我有一个Angular + ASP.Net WebAPI应用程序。我正在向API发布JSON查询,并获得RSS格式的Feed。
Hi,
I have an Angular + ASP.Net WebAPI Application. I am posting a JSON query to an API and in return getting the RSS formatted feed.
$scope.rss = function(query){
$http.post("api/url", query)
.success(function(response){
//I have RSS feed (xml string) in response
//But cannot publish it as RSS
/*response = "<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
...
</channel>
</rss>"*/
})
.error(function(e){
//error
});
}
现在,我的API接受 HttpPost
,而我不能使用 HttpGet
因为,查询可以变得非常大。有没有办法解决它?
Now, my API accepts HttpPost
, and I cannot use HttpGet
because, the query can get really big. Is there any way to solve it?
答
scope.rss = function (查询){
scope.rss = function(query){
http.post( api / url,query)
.success( function (response){
// 我有RSS feed(xml字符串)作为回应
// 但是无法将其发布为RSS
/ * response =<?xml version =1.0 encoding =UTF-8?>
< rss version =2.0>
< channel>
...
< / channel>
< / rss>* /
})
.error( function (e){
// error
});
}
http.post("api/url", query) .success(function(response){ //I have RSS feed (xml string) in response //But cannot publish it as RSS /*response = "<?xml version="1.0" encoding="UTF-8" ?> <rss version="2.0"> <channel> ... </channel> </rss>"*/ }) .error(function(e){ //error }); }
现在,我的API接受 HttpPost
,而我不能使用 HttpGet
因为,查询可以变得非常大。有什么办法可以解决吗?
Now, my API accepts HttpPost
, and I cannot use HttpGet
because, the query can get really big. Is there any way to solve it?