Sha256: a4498e5f1394e576fb30ac4663c1dd13140aaac5e0217a81d7c92aa9ebc19096
Contents?: true
Size: 859 Bytes
Versions: 22
Compression:
Stored size: 859 Bytes
Contents
/** * comment_ajax.js: * * Copyright (C) 2013 by MATSUOKA Kohei <kohei@machu.jp> * You can distribute it under GPL. */ $(function() { $(document).on('submit', 'form.comment', function(e) { e.preventDefault(); var form = $(this); $('<input type="hidden">').attr('name', 'comment').appendTo(form); $(':submit', form).attr('disabled', 'disabled'); $('div.button input', form).hide(); $('div.button', form).append('<div id="loading-button"><img src="theme/loading.gif">') $.post(form.attr('action'), form.serialize(), function(data) { $('#loading-button').remove(); $('div.button input', form).show(); form[0].reset(); $(':submit', form).removeAttr('disabled'); // $(data) is a diary HTML of the day $('div.comment:first', form.parents('div.day')) .after($('div.comment', $(data))) .remove(); }, 'html'); }); });
Version data entries
22 entries across 22 versions & 1 rubygems