简体   繁体   English

带Post请求的Angularjs

[英]Angularjs with Post requests

I already have a project in Asp.Net MVC 5 and C# which is currently running on production. 我已经在Asp.Net MVC 5和C#中有一个项目,该项目当前正在生产中运行。

Now i have created a separated project of angularjs which is for mobile devices, I am unable to send post web api call from angular becoz of "Cross domain" access. 现在,我已经为移动设备创建了一个单独的angularjs项目,我无法从“跨域”访问的angular becoz发送发布Web api调用。

Can somebody suggest me what do do. 有人可以建议我做什么。

  1. If their is any architecture change need to do to achieve such functionality. 如果是任何架构,则需要进行更改以实现此类功能。
  2. any way to call ajax post outside domain. 以任何方式在域外调用ajax发布。

What version of Web API are you using? 您正在使用哪个版本的Web API? You might be able to use CORS which is really easy to implement and you won't have to change your architecture to implement it. 您可能可以使用真正易于实现的CORS,而无需更改体系结构即可实现。 Look at this article to help you out Look at this article to help you out 看这篇文章可以帮助您看这篇文章可以帮助您

If that isn't able you help you, you can use Jsonp to call your web service from angular js. 如果那不能为您提供帮助,则可以使用Jsonp从angular js调用Web服务。 There's a few tricks with it but it will solve the cross domain problem. 有一些技巧,但可以解决跨域问题。 Using jsonp in angular js 在angular js中使用jsonp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM