I have function which run under promise and I want to start another function promise resolved. But I could not do that. Below is my promise function
var promise1
$(document).ready(function() {
promise1 = new Promise(function(resolve, reject) {
getData(url).then(function(data) {
// do something
})
})
})
Now on the same page different web part we want another function run but only after finish of above function
$(document).ready(function() {
promise1.then(function(d) {
var commentURL ="https://xxxx"
loadComments(commentURL)
})
})
but second function never runs, please help me