1:原理 在js中, 2:实现 http://localhost:62203/home/index页面代码如下 @{ Layout = null;}<!DOCTYPE html><html><head> <meta name=&q ...
1:原理
在js中,
2:实现
http://localhost:62203/home/index页面代码如下
@{ Layout = null;}<!DOCTYPE html><html><head> <meta name="viewport" content="width=device-width" /> <title>Index</title> <script> function showMessage(result) { alert(result.name) } </script> <script src='/images/loading.gif' data-original="http://localhost:16308/home/index?callback=showMessage" type="text/javascript"></script></head><body> <div> </div></body></html>
这是在Controller就可以直接使用this.Jsonp了,把跨域服务端的代码改下
public ActionResult Index() { return this.Jsonp(new { name = "server JsonpResult" }); }
原标题:ASP.NET MVC 定义JsonpResult实现跨域请求
关键词:ASP.NET
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。