Skip to content

Instantly share code, notes, and snippets.

@willprice76
Last active August 29, 2015 14:17
Show Gist options
  • Save willprice76/1afa5f1d9314efddc729 to your computer and use it in GitHub Desktop.
Save willprice76/1afa5f1d9314efddc729 to your computer and use it in GitHub Desktop.
Simple Javascript example to illustrate AJAX loaded content being editable in XPM
// Load test HTML content client side
$( document).ready(function() {
loadContent("dynamic-test","/dynamic.htm");
});
//Load content from a URL into the specified HTML element
function loadContent(elementId,url) {
$("#" + elementId).load(url, function () {
startXpm("http://my-cms-url");
});
}
//Load the XPM bootstrap Javascript
function startXpm(cmsUrl)
{
$("body").append($("<script />", {
src: cmsUrl + "/WebUI/Editors/SiteEdit/Views/Bootstrap/Bootstrap.aspx?mode=js"
}));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment