How to Display SharePoint Online 365 List Items on non - share point site , you can say a site built using html. how we can connect? I have tried using simple html page and REST API. its giving error as "Access Denied". Looks like I am missing something or i am using wrong methods. Please help
below is my code :
- <html>
- <head>
- <script src="/jquery.min.js"></script>
- <script>
- $(document).ready(function() {
- function executesearch(){
- var siteurl = "https://abc.com/sites/space2/xyz/_api/lists/getbytitle('Pages')/Items";
- $.ajax({
- url: siteurl,
- method: "GET",
- headers: { "Accept": "application/json; odata=verbose" },
- success: function (data) {
- if (data.d.results.length > 0 ) {
- alert(data);
- }
- },
- error: function (data) {
- alert("Error: "+ siteurl);
- }
- });
- }
- $("#search-button").off().click(function(e) {
- executesearch();
- });
- });
- </script>
- </head>
- <body>
- <div class="test">
- <button class="btnsearch" id="search-button">
- FIND CONTENT</button>
- </div></body>
- </html>