2017-09-10 80 views
0

作爲我的要求的一部分,我想通過從jquery ajax調用調用O365 url來生成授權代碼。我打電話以下腳本文件準備就緒() Jquery ajax調用生成授權代碼

  $.ajax({              
      type: 'GET', 
      dataType: 'jsonp', 
      async: false, 
      url: 'https://login.microsoftonline.com/{{tenant id}}/oauth2/authorize?client_id={{client id}}&response_type=code&redirect_uri=https://myurl.com/createpage/&response_mode=query&resource={{resource}}&state=9128', 
      crossDomain: true, 
      success: function(jsonData) { 
        alert(jsonData); 
      }, 
      error: function(request, textStatus, errorThrown) { 
       console.log(errorThrown); 
      }, 
      cache: false 
     }); 

但越來越以下錯誤。 Jquery ajax error

要求您協助解決問題。

回答

0

您應該檢查標籤網絡中的響應內容(在您的開發工具中)。

我猜這個響應不是一個有效的json,所以解析失敗(你指定的jsonp類型在你的ajax調用中)