//支持跨域调用
$.ajax({
type:"POST",
async :false,
url:"http://web3.com:9080/authority/dept/hellob.shtml?userName=zqb&callback=?",
dataType:"jsonp",
success:function(data){
//alert(data);
console.log(data);
},
error:function(){
alert("error");
}
});
}
//不支持跨域调用
function b(){
$.ajax({
type: "post",
dataType: "html",
url: "http://web3.com:9080/authority/dept/hellob.shtml?userName=zqb",
data: "",
success: function (data) {
console.log(data);
}
});
}
ajax跨域调用和非跨域调用的写法
最新推荐文章于 2022-10-16 16:16:47 发布