Skip to content

Instantly share code, notes, and snippets.

@zofe
Created October 14, 2015 20:46
Show Gist options
  • Save zofe/51734e3a5a280ae43cc0 to your computer and use it in GitHub Desktop.
Save zofe/51734e3a5a280ae43cc0 to your computer and use it in GitHub Desktop.
remote riot/pjax tag usage: <remote id="login_modal" remote="/users/login/modal"></remote>
<remote>
<div id="pjax-{ opts.id }"></div>
<script>
this.on('mount', function(){
$.get( opts.remote, function( data ) {
$( '#pjax-'+opts.id).html( data );
});
$(document).on('submit', '#pjax-'+opts.id+' form', function(event) {
$.pjax.submit(event, '#pjax-'+opts.id, {push: false, scrollTo: false})
});
});
</script>
</remote>
@zofe
Copy link
Author

zofe commented Oct 14, 2015

I use this riotjs tag to embed a rapyd dataform in a modal context..
where I can't reload the page but just a div.

requirements are jquery, riotjs and pjax libraries

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment