Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 重定向Ajax后获取url_Javascript_Ajax_Api_Instagram - Fatal编程技术网

Javascript 重定向Ajax后获取url

Javascript 重定向Ajax后获取url,javascript,ajax,api,instagram,Javascript,Ajax,Api,Instagram,要在Instagram上进行身份验证,我需要获取Instagram发送给我的url作为重定向。我需要得到重定向的url,但我得到了一个空值 $.ajax({ url: "https://instagram.com/oauth/authorize/?client_id=e40f15a90**c89851d8a66&redirect_uri=http://examle.com&response_type=token", success:function(result,status,

要在Instagram上进行身份验证,我需要获取Instagram发送给我的url作为重定向。我需要得到重定向的url,但我得到了一个空值

$.ajax({
url: "https://instagram.com/oauth/authorize/?client_id=e40f15a90**c89851d8a66&redirect_uri=http://examle.com&response_type=token",

success:function(result,status,xhr){
console.log(xhr.getResponseHeader('Location'));<---NULL
}

});
$.ajax({
url:“https://instagram.com/oauth/authorize/?client_id=e40f15a90**c89851d8a66&重定向uri=http://examle.com&response_type=token",
成功:功能(结果、状态、xhr){

console.log(xhr.getResponseHeader('Location'));在请求导致重定向后,无法获取头信息。标准方法是使用auth url(“”)打开新的子窗口, )并在重定向url中检索令牌,例如在
onready事件中http://examle.com
之后,将令牌发送到父窗口并关闭弹出窗口(子窗口)


推荐Instagram AUTH是服务器端,所以考虑使用它。

我不认为这是可能通过Ajax——因为这是一个请求在后台,浏览器将遵循自动重定向。因此,当控件返回到您的脚本时,不再有<代码>位置< /代码>标题。问题是我是MA。一个移动应用程序的王,我没有服务器。我必须考虑哪个URL作为重定向URL?@ PoChePtSOV