Created
October 14, 2015 20:46
-
-
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>
This file contains hidden or 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
<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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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