I have been banging my head against the wall for a couple of days now. I'm trying to add an item to a list in Sharepoint with Angular js.
Retrieving items is smooth but adding items doesn't work for me.
Code:
spApp.controller('spListCtrl', function($scope, $http, $q) { $http.post("https://tools.site.com/_api/lists/getbytitle('PersonalFilter')/items", {'Title': 'TEST' }, { headers: {'Accept': 'application/json; odata=verbose','X-RequestDigest': $("#__REQUESTDIGEST").val() } }).success(function(data, status, headers, config) { console.log("YES"); }).error(function(data, status, headers, config) {});});I have done this before with jQuery Ajax (in a similar fashion) but I can't seem to locate the problem.
The script is running on the same site as to where the call is made, so no Cross-Domain calling. Furthermore this is embedded with the script editor, so this is running directly inside a Sharepoint Masterpage.
Any suggestions?