Created
April 18, 2013 18:21
-
-
Save vinicius73/5415021 to your computer and use it in GitHub Desktop.
passando dados do php para javascript via atributos data-*
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
<!-- Link ou elemento html, adicione os elementos data-* onde quiser --> | |
<a class="link_ajaz_modal_box" data-url='http://minha_url_ajax_feita_pelo_php.com/conteudo/ajax' href="#">Link Ajax</a> | |
<script> | |
//recupere tudo usando $.data do jquery | |
$('.link_ajaz_modal_box').click(function(){ | |
var URL = $(this).data('url'); //aqui eu pelo o elemento data-url | |
$('#elemento').load(URL); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment