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

Failing to get list data using Ajax REST API call in SharePoint 2013 site

$
0
0

Hi All,


I am working on some google charts in SharePoint 2013 site. I have a list in test environment and I do an ajax rest api call to this list and work on the data that has to be passed to google chart.

function LoadProjectData (param) {
                
    
 var listName = "CI%20Training%20Projects";    
 //var url = _spPageContextInfo.webAbsoluteUrl;
var url="https://apps.connect.sample.com/sites/CITraining" ;
alert('before ajax call:'+url);
 $.ajax({url: url+"/_api/web/lists/getbytitle('CI%20Training%20Projects')/items",     
 method: "Get",  
 headers: { "Accept": "application/json; odata=verbose" },   
 
 success: function (data)
 {
     alert('inside success');
     projectdata(data);
 },  
 error: function (data)
 {  
    alert("Failed to get details");
 }
 });
}

The above code works fine in the test environment but if i change the url to the production url, I am getting "Failed to get details" which is in error function.

Can anyone help me on how to get data from different web applications using REST. I have included necessary javascripts.

Thanks in advance


Thanks, Ranjana


Viewing all articles
Browse latest Browse all 7589

Trending Articles



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