jsonp 的 post

jsonp不能post!

1. jsonp的请求都为get

2. jsonp相当于loadJS, 返回的"数据"直接以js执行

$.ajax({
    url : "/static/get.php",
    data : {
        aa : "name"
    },
    type : "post",
    success : function(data){
        alert(data);
    }
})

抓包可以看到:

jsonp 的 post_第1张图片

请求:

http://xx/get.php?callback=jQuery17208796953377313912_1366782553589

但type:"get" 或 type:"post",dataType:"jsonp"时,一样都是get方式:

jsonp 的 post_第2张图片

请求:

http://xx/get.php?callback=jQuery17200924667939543724_1366782587492&aa=name&_=1366782587548

跨域需要jsonp时,只能用$_REQUEST获取参数

 

你可能感兴趣的:(jsonp 的 post)