ASP.NET MVC 2 JSONP 与 MVC Futures
我使用 mvc futures 2 和 WebApiEnabled 来支持 XML 和 JSON。但由于 jQuery $.ajax 的跨域问题,我正在寻找 JSONP。
有没有一种简单的方法来扩展 JSONP 的 future 休息功能,或者我应该做其他事情。
有人对这个主题有一些提示吗?
I´m using mvc futures 2 with WebApiEnabled for XML and JSON support. But due to cross domain issues with jQuery $.ajax I´m lookin in to JSONP.
Is there a simple way to extend futures rest function for JSONP or should I do something else.
Do anyone have some hints on this subject ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
REST for ASP.NET MVC SDK 包含一个 Word 文件,解释如何通过添加自定义格式来扩展它:
在包含的
MovieApp
示例中,您将找到AtomFormatHandler
的实现,您可以将其用作添加 JSONP 功能的基础。我还写了一个 JsonpResult你可以看一下。The REST for ASP.NET MVC SDK contains a Word file explaining how you could extend it by adding a custom format:
In the included
MovieApp
sample you will find an implementation forAtomFormatHandler
which you could use as a base for adding the JSONP functionality. I've also written a JsonpResult which you may take a look at.