2015-09-25 50 views
0

这是我的div:展望办公室加载项不显示HTML页面中DIV

<body> 
    <div id="content"></div> 
</body> 

,这是我的代码背后的JS:

function jsonParser(sender) { 
    $.ajax({ 
     type: "GET", 
     url: "http://MYURL/customers/outlook?email=" + sender + "&jsonp=true", 
     dataType: "jsonp", 
     success: function (htmlPage) { 
      document.getElementById("content").innerHTML = htmlPage.htmlText; 
     } 
    }); 
} 

这是调用它的代码:

function detectActionsForMe() { 
    var item = Office.cast.item.toItemRead(Office.context.mailbox.item); 
    var sender = item.sender.emailAddress; 
    jsonParser(sender); 
} 

我实际上无法获取下载的html页面,以显示在Outlook(2016)插件窗口中。我已经尝试使用iframe,但我什么也没有获得。

我确信我正在收到的这个页面,我觉得这很奇怪,它不会显示在Outlook框中。

回答

1

我发现少了什么,这要归功于http://www.sitepoint.com/jsonp-examples/

基本上,我只是说了以下的AJAX调用:

contentType: "application/json", 
dataType: "jsonp", 

和它的所有工作! :)