Changes between Version 1 and Version 2 of AjaxPrototypeNewForms
- Timestamp:
- Mar 10, 2007, 6:22:23 AM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
AjaxPrototypeNewForms
v1 v2 103 103 // where to submit the form 104 104 var ajaxurl = aform.action; 105 var formparameters = aform.serialize(true); // take the form field values before you disable it 106 107 //disable the form elements while beeing processed 108 aform.disable(); 105 109 106 110 // get the submit button of the form and show an ajax-loader instead … … 116 120 var myAjax = new Ajax.Request( 117 121 ajaxurl, 118 { method: 'post', parameters: aform.serialize(true), onComplete: handlereq }); 122 { method: 'post', 123 parameters: formparameters, 124 onSucess: handlereq, 125 onFailure: function() {alert('Refresh the Page, something happend to the server');} // what to do if the server return something else than 2xx status. 126 }); 119 127 120 128 function handlereq(req) { … … 135 143 }); 136 144 137 $('ajaxloader').remove() // remove the ajax-loader 138 submitbutton.show() // return the submit button 145 aform.enable(); // enable the form 146 $('ajaxloader').remove(); // remove the ajax-loader 147 submitbutton.show(); // return the submit button 139 148 } 140 149 }