I want to add a line of text after an html tag with the id skillLevel. I can find the id and get the text back but how to I actually update it?
var skillString = "<p> " + users_name + " - " + email + '</p>'; var skillName = input.name; var skillLevel = input.value; $.get('/rest/api/content?spaceKey=EXPERTISE&title=' + skillName + '&expand=space,body.storage,version,container', function (data, status) { var pageData = data.results[0]; var existing_body = pageData.body.storage.value; pageData.version.number += 1; var page_id = pageData.id; var target_bin = $(existing_body).find('#' + skillLevel);
// This will print out the text I want to add a line to.
alert(target_bind.text());
// Neither of these two ways to update seem to work.
//$('#'+skillLevel).append(skillString); //$(target_bin.text()).append(skillString); } $.ajax({ type: "PUT", url: "/rest/api/content/" + page_id, data: JSON.stringify(pageData), contentType: "application/json; charset=utf-8", success: function (data) { alert("Successfully added info"); } }); });
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.