脚本跨域跨域

客户端:
 
   $.ajax({
            url: "http://localhost:13073/home/index",
            data: { name: "123" },
            method: "get",
            async:false,
            dataType: "jsonp",
            jsonp: "callback",
            jsonpCallback:"filght",
            success: function (data) {
                alert(data);
            }
        });

服务端:

public ActionResult Index()
        {
            string name = Request["name"].ToString();
            string callback = Request["callback"].ToString();

            return Content(callback+"("+name+")");
           
        }

 

posted @ 2016-01-23 17:17  haohaizi  阅读(257)  评论(0编辑  收藏  举报