在ajax 中要跨域名 请求的时候要注意
1. dataType: ‘jsonp’,
2. jsonp: ‘callback’,
<script type="text/javascript">
$(document).ready(function () {
var urle = "http://www.hao123.com";
$.ajax({
url: urle,
type: 'GET',
dataType: 'jsonp',
jsonp: 'callback',
success: function (data) {
alert(data);
}
});
});
</script>
3.在被调用的页面上
Response.Write(Request["callback"] + "('{\"Code\":-10000,\"Message\":\"对的\"}')");
Response.End();