Can not view json api data using ajax and javascript for Outlook plugin


I am creating an outlook plugin for one of my projects and I used the Visual Studio VB Outlook Add-In to create the predefined template. The HTML file works well but the script in HTML file has issue processing the ajax success() function. The office libraries do not let the native java script functions run (like alert statements). The data from API can be viewed in console but cannot be caught using a DIV or JSON(stringify) methods.

Here is HTML Code:

<form id="loginform" class="loginform">
<input type="text" id="server" placeholder="SERVER" required />
<input type="text" id="username" placeholder="USERNAME" required />
<input type="password" id="password" placeholder="PASSWORD" required />
<button type="submit" id="btnLogin" onclick="return getLogin();">

<p class="apidata"> The API Data is : <br /> </p>
Here is the script which is in the same HTML File

<script type="text/javascript">
function getLogin() {

var server = document.getElementById("server").value;
var usableURL = "" + server + "/rest/v1/alarms";
url: usableURL,
type: "GET",
cors: true,
dataType: 'jsonp',
jsonp: false,
jsonpCallback: 'callback',
crossDomain: true,
contentType: 'application/json; charset=utf-8;',
secure: false,
cache: false,
headers: {
//headers here
data: {
"sdate": "2019-05-01T00:00:00",
"ack": "false",
format: "json"
success: function (response) {
//var s = $.parseJSON(response.responseText);
document.getElementById("apidata").innerHTML = JSON.stringify(response.responseText);

error: function (error) {
return false;

I can not get the data into DIV here and my data type has to be jsonp because the rest api i am trying has CORS enabled

Any way to solve this view issue?

0 Replies