diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2008-09-18 09:56:08 -0400 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2008-09-18 09:56:08 -0400 |
commit | 054b4d0be6f3d524a602d787380d9da5986c1f9f (patch) | |
tree | e7beef43174510044f6a0d8a2b2a0cfba3cf1589 /js | |
parent | fbe15efde4c8ae6226bc6bc90a28e29668f744f1 (diff) |
if favor/disfavor submitted through ajax, return micro-html of form
darcs-hash:20080918135608-5ed1f-d753cb01f96e04871eb4f503ccd258674a03623a.gz
Diffstat (limited to 'js')
-rw-r--r-- | js/util.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/js/util.js b/js/util.js index d5e1c8720..9f66e393c 100644 --- a/js/util.js +++ b/js/util.js @@ -68,9 +68,20 @@ $(document).ready(function(){ var id = new_form.id.replace('favor', 'disfavor'); $('form#'+id).replace(new_form); }}; - + + function addAjaxHidden(form) { + ajax = document.newElement('input'); + ajax.addAttribute('type', 'hidden'); + ajax.addAttribute('name', 'ajax'); + ajax.addAttribute('value', 1); + form.appendChild(ajax); + } + $("form.favor").ajaxForm(favoptions); - $("form.disfavor").ajaxForm(disoptions); + $("form.disfavor").ajaxForm(disoptions); + + $("form.favor").each(addAjaxHidden); + $("form.disfavor").each(addAjaxHidden); }); function doreply(nick) { |