解决“No 'Access-Control-Allow-Origin' header is present on the requested resource.”

$("#btnGet").bind("click",function () {
            	$.ajax({
                		url: "http://localhost:51571/api/Account/1",type: "GET",dataType:"jsonp",success:function(result) {
                    		alert(result[0].Id+","+result[0].Name+","+result[0].Email);
                		}
            	});
});
指定dataType为jsonp,而不是json即可!

相关文章

文章浏览阅读2.4k次。最近要优化cesium里的热力图效果,浏览...
文章浏览阅读1.2w次,点赞3次,收藏19次。在 Python中读取 j...
文章浏览阅读1.4k次。首字母缩略词 API 代表应用程序编程接口...
文章浏览阅读802次,点赞10次,收藏10次。解决一个JSON反序列...
文章浏览阅读882次。Unity Json和Xml的序列化和反序列化_uni...