Using Ajax

By default th plugin locks content of an initial element. But you can also load content via ajax.

Live Example:

Code:

$(".to-lock").sociallocker({

    theme: "flat",

    content: {

        // url to get ajax content
        url: "ajaxtest.html",

        // Notice:
        // the plugin will automatically take the response from the request and 
        // set it for you if you don't override the default success handler.

        // however, if you intend on using your own success callback, 
        // you'll need to set it yourself using the following way:
        success: function (api, data) {

            // finds content inside the response that we want to put
            var content = $("<div>").html(data).find("#content");

            // sets content for the locker
            api.element.html(content);
        }
    }
});
OnePress (c) 2016. Learn more about Social Locker for jQuery.