Last active
May 16, 2016 06:00
-
-
Save Rukomoynikov/2d50fdfbf707bc7a4d090c8c16f9c816 to your computer and use it in GitHub Desktop.
rails ujs
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
$('#formContainer').html('<form novalidate="novalidate" class="simple_form new_contact" id="new_contact" action="/contacts" accept-charset="UTF-8" data-remote="true" method="post"><input name="utf8" type="hidden" value="✓"><div class="form-inputs"><div class="input string optional contact_type"><label class="string optional" for="contact_type">Type</label><input class="string optional" type="text" name="contact[type]" id="contact_type"></div><div class="input string optional contact_content"><label class="string optional" for="contact_content">Content</label><input class="string optional" type="text" name="contact[content]" id="contact_content"></div><div class="input integer optional contact_user_id"><label class="integer optional" for="contact_user_id">User</label><input class="numeric integer optional" type="number" step="1" name="contact[user_id]" id="contact_user_id"></div></div><div class="form-actions"><input type="submit" name="commit" value="Create Contact" class="btn"></div></form>') | |
$('#new_contact').on('ajax:success', function(event, xhr, status, error) { | |
$(this).append(xhr.responseText) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment