I hope I'm just doing some little thing wrong, but in the following code I call writeNew from the .done clause of a write to a different list (which always works), and although execution gets to that secondary function, the SPServices operation doesn't happen. If I call that writeNew function before the first write operation, it works fine.
Hoping you can see something obvious:
Hoping you can see something obvious:
$(document).ready(function() {
//writeNew("Happy", "Birthday"); //works fine
...
vpairTo.push($().SPServices.SPGetCurrentUser({fieldName: 'Email'}));
...
var newPromise = $().SPServices({
operation: "UpdateListItems",
batchCmd: "New",
listName: "{ED0039D0-26F7-49A9-8EA3-C7168D1756E0}",
valuepairs: vpairs
}); // works fine
newPromise.done(function() {
...
writeNew(strID, userAgain); //gets to writeNew but doesn't write
});
newPromise.fail(function() {
alert("failed: newPromise for " + vpairTo);
});
...
});
function writeNew(strID, userAgain) {
alert("We're in writeNew with " + strID + ", " + userAgain);
var newlyPromise = $().SPServices({
operation: "UpdateListItems",
batchCmd: "New",
listName: "{4EA9668B-DCF5-4B0E-B40C-F0852A2A29AF}", //ResponseByLesson, Michael
valuepairs: [["Title",strID],["Responder",userAgain]]
});
newlyPromise.done(function() {
alert("Happy to see you!");
});
newlyPromise.fail(function() {
alert("Boo hoo!");
});
}
...