Simpltry Ajax Update Callback

On quite a few modern sites content is loaded with an ajax call. The prototype way of doing this is through an Ajax.Updater call. It is desirable to include widgets in your Ajax.Updater content. Fortunately, there is an extremely easy way to do this. Treat your partial content exactly like your initial content, and include a specially written onComplete function that does everything for you.

This content will get replaced when you click update below

update

<div id='updated'>
    <p>This content will get replaced when you click update below</p>
</div>
<p>
    <a href="#" onclick="new Ajax.Updater('updated', 'update.html',
            {evalScripts:true, onComplete: 
             Simpltry.Widgets.updateComplete}); return false;">update<</a>
</p>
		    

Note you should not be assigning things directly to your onclick attribute, I did so here for simplicity of demoing. The key in the previous code block is the onComplete option. As you can see it is set to Simpltry.Widgets.updateComplete. That gets called after the Ajax.Updater completes. It inspects the content that just came in from your Ajax.Updater call and assigns any widgets it knows about. In the example it is an Inplace editor but it could be any simpltry widgets or anything you have registered as a widget.