I using the code below, but and the script that creates the folder on my SP online server is working just fine, but the problem is that return data is undefined
$.when(pCreate(path + "/" + name)).always(function (data) {
console.log("data");
console.log(data);
});
var pCreate = function (pathAndName) {
getFormDigest(pageContent.web.absoluteUrl).then(function (data) {
$.ajax({
"url": pageContent.web.absoluteUrl + "/_api/Web/Folders/add('Shared Documents" + CustomerStartingFolder + pathAndName + "')",
"type": "POST",
"headers": {
"accept": "application/json; odata=verbose",
"content-type": "application/json; odata=verbose",
"X-RequestDigest": data.d.GetContextWebInformation.FormDigestValue
}
});
});
}
Can someone point out what is wrong since I dont get the return data of the created folder?