The code below doesn't change mytoggle from 0 to 1 which is what should happen according to this SO link. Is this somehow Confluence related?
var mytoggle = 0;
$.ajax({
type: "PUT",
url: "/rest/api/content/" + page_id,
data: JSON.stringify(pageData),
contentType: "application/json; charset=utf-8",
success: function (data) {
mytoggle = 1;
},
});
alert(mytoggle);