Frappe webforms get doc and save

Is it possible to save a doc in webform javascript file? using call fucntion I got the doc but when I save it says type error task.save is not a function
frappe.call({
method: “frappe.client.get”,
args: {
doctype: “Attendance”,
name: “ATT-2019-00015”,
},
callback(r) {
if(r.message) {
var task = r.message;
console.log(task);
frappe.model.set_value(task.doctype, task.name, “route”, ‘hello’);
task.save();
}
}
});