-
-
Save Olefine/5619067 to your computer and use it in GitHub Desktop.
json ajax rz2
This file contains 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
$(document).ready -> | |
$('div#reload_form form').submit (event) -> | |
event.preventDefault() | |
form = $(this) | |
url = form.attr('action') | |
ammo = $('#ammo_to_reload').val() | |
$.ajax | |
type: 'put' | |
url: url | |
data: {ammo_to_reload: ammo} | |
dataType: 'json' | |
success: (json) -> | |
$('#ammo').text(json.ammo).effect("highlight") | |
$('#reload_form').fadeOut() if json.ammo >= 30 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment