0

I am new to Office.js API. I am trying to develop Web Add-In for Excel and I need to get data from WebAPI for this I am trying to use ajax but its not working

Here is very simple Ajax code

    $.ajax({
        url: "http://localhost:61721/api/values",
        type: "GET",
        dataType:"JSONP",
        success: function (data) {
            $("#div1").html(JSON.stringify(data));
        },
        error:function(error){}
    });

Update

Is there any alternative way other than Ajax in Office.js through which we can get data from Web API?

user3881465
  • 239
  • 2
  • 5
  • 19
  • Would this answer your question: [Send POST AJAX request from Office Add-In](https://stackoverflow.com/questions/45308473/send-post-ajax-request-from-office-add-in/45308930#45308930) – Slava Ivanov Jul 26 '17 at 15:44

1 Answers1

0

From the client, AJAX requests must be send to SSL URIs and those URIs must be declared in AppDomain list of the app manifest. Please refer to: Send POST AJAX request from Office Add-In.

In the same time, if your app has server side portion of code, you may send direct request to any Web API from there. Nobody limit you in technology (REST, microservices, etc.) and nobody check your connection is secure, when using 3rd party resources from your server.

Slava Ivanov
  • 6,666
  • 2
  • 23
  • 34