Poll plugin: make the polling response form submit via AJAX and return the results.

Now, any form marked with 'ajax' class will get the simple FormXHR treatment. Should help cut down on code that just adds that into individual forms.
This commit is contained in:
Brion Vibber
2011-03-08 13:45:51 -08:00
parent ba1ada2880
commit 90f1cfcfc0
5 changed files with 30 additions and 4 deletions

View File

@@ -1380,6 +1380,16 @@ var SN = { // StatusNet
});
},
/**
* Set up any generic 'ajax' form so it submits via AJAX with auto-replacement.
*/
AjaxForms: function() {
$('form.ajax').live('submit', function() {
SN.U.FormXHR($(this));
return false;
});
},
/**
* Add logic to any file upload forms to handle file size limits,
* on browsers that support basic FileAPI.
@@ -1416,6 +1426,7 @@ var SN = { // StatusNet
* don't start them loading until after DOM-ready time!
*/
$(document).ready(function(){
SN.Init.AjaxForms();
SN.Init.UploadForms();
if ($('.'+SN.C.S.FormNotice).length > 0) {
SN.Init.NoticeForm();