Last active
August 29, 2015 14:17
-
-
Save willprice76/1afa5f1d9314efddc729 to your computer and use it in GitHub Desktop.
Simple Javascript example to illustrate AJAX loaded content being editable in XPM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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