getJSON for office apps RRS feed

  • Question

  • Hi

    I'm developing a WORD task pane app. I have some troubles with loading a JSON file. My app works fine if I use next functions

    // Reads data from current document selection and displays a notification
        function getDataFromSelection() {
                function (result) {
                    if (result.status === Office.AsyncResultStatus.Succeeded) {
                    } else {
                        app.showNotification('Error:', result.error.message);
        function showImages(result) {
            var parameters = {
                tags: result,
                tagsmode: "any",
                format: "json"
                            function (results, succes) {
                                $.each(results.items, function (index, item) {
                                    $('#Test').append($("<img />").attr("src",;

    I get some Flickrs pictures.
    But if I try another example

        function johnDoe() {
                function (results, succes) {
                    $.each(results, function (i, field) {
                        $("#Test").append(field + " ");

    I don't even get an notification with 'succes' or 'timeout'. Can someone help me out?
    It is the last step in my project, and I'm already a long time busy with searching and trying.

    Thank you very much,


    thanks, Emiel

    Thursday, August 13, 2015 7:28 PM


  • Hi Emiel,

    As far as I test, when I put the JavaScript on the local, the code works well for me. It seems when we use getJson method to get the JavaScript file, it has the same-origin policy limitations.

    To overcome same-origin policy enforcement when you develop add-ins, you can:

    • Use JSON/P for anonymous access.

    • Implement server-side script using a token-based authentication scheme.

    • Using cross-origin resource sharing (CORS).

    • Build your own proxy using IFRAME and POST MESSAGE.

    You can get more detail about it from link below:
    Addressing same-origin policy limitations in Office Add-ins

    Regards & Fei

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, August 14, 2015 10:07 AM