Skip to content

Instantly share code, notes, and snippets.

@davsket
Created March 13, 2013 05:23
Show Gist options
  • Save davsket/5149571 to your computer and use it in GitHub Desktop.
Save davsket/5149571 to your computer and use it in GitHub Desktop.
Tesis Jose
/**
* Tesis Jose
*/
<!-- content to be placed inside <body>…</body> -->
<ul class="img-container">
<li>
<img src="http://placekitten.com/g/200/300" data-name="cat-one">
<p></p>
</li>
<li>
<img src="http://placekitten.com/g/200/300" data-name="cat-two">
<p></p>
</li>
<li>
<img src="http://placekitten.com/g/200/300" data-name="cat-three">
<p></p>
</li>
</ul>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
console.log($('.img-container'))
$('.img-container').on('click', 'img', function(){
var img = this
$.ajax({
dataType: 'jsonp',
url: 'http://omg.monoku.com:8001/login/',
data: {
password: 'estoEsRelleno',
username: 'esSoloParaQueRespondaJSONP',
name: img.getAttribute('data-name')
}
})
.done(function( data ){
$(img).next().html( data.message )
})
})
</script>
{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"html"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment