Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Access Denied Error when calling service from o365.

$
0
0

HI i am calling web service from 0365 page, to get a data of json format. where i am getting no transport error...i resolved it by adding   $.support.cors = true; however the moment the line was added am getting new error  Access Denied. below  is my code snippet....please suggest me where am doing wrong

      <script src="/sites/epm/SiteAssets/JS/jquery.min.js"></script>
     <script src="/sites/epm/SiteAssets/JS/jquery-ui.js"></script>
       <script type="text/javascript">
        $(document).ready(function () {
            $('#button').click(function () {
                $.support.cors = true;
                var url ="https://abc.com/api/controlname/GetProjectName";
                var requestData = {"Projid":"8F594637-4601-E611-810A-00155DD09603"};
        $.ajax
                        ({
                            url: url,
                            data: requestData,
                            type: "POST"
                            dataType: "json",
                            success: function (res) {
                                console.log(res);
                                 alert(res);

                            },
                            error: function (jqXHR, textStatus, errorThrown){

                                alert(textStatus + errorThrown);

                            }
                         
                        });
             });
         });
    </script>

<input type="button" value="submit" name="submit" id="button">

                                                              

prasanna


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>