使用form请求,ajax请求要单独设置跳转(ajax是页面局部刷新)
w.Header().Set(“Access-Control-Allow-Origin”, “*”) w.Header().Set(“Access-Control-Allow-Headers”: “X-Requested-With,X_Requested_With,X-PINGOTHER,Content-Type”); w.Header().Set(“Access-Control-Allow-Headers”,“Content-Type” )
function showData (result) {}
$("head").append("\<script src='http://localhost:9090/student?callback=showData'><\/script>");
jquery封装了以上操作jsonp
function showData (result) {}
$.ajax({
url: "http://localhost:9090/student",
type: "GET",
dataType: "jsonp", //指定服务器返回的数据类型
jsonpCallback: "showData",
})
html添加meta标签,请求不带referer
<meta name="referrer" content="never">