Project

General

Profile

« Previous | Next » 

Revision 6667

Added by Jing Tao about 13 years ago

Add methods to send form parameters to the server.

View differences:

lib/style/common/ajax-utils.js
42 42
	//alert("after update");
43 43
}
44 44

  
45
/* submits parameters serialized from a form via ajax and inserts the results into the given div  
46
 *  Params:
47
 *    url - url to hit
48
 *    formId - id of the form to submit
49
 *    divId - the name of the div where the results should be put
50
 */  
51
function submitFormParasIntoDiv(url, formParas, divId) {
52
	//alert('Form object: ' + formObj);
53

  
54
	var myRequest = new Ajax.Updater(divId, url,
55
		{	method: 'post',
56
			parameters: formParas
57
		});
58
	//alert("after update");
59
}
60

  
45 61
/* submits a form via ajax and inserts the results into the given div  
46 62
 *  Params:
47 63
 *    url - url to hit
......
64 80
 *    formId - id of the form to submit
65 81
 *    divId - the name of the div where the results should be put
66 82
 */  
67
function submitFormObjIntoDivAndReload(url, formObj, divId) {
83
function submitFormParasIntoDivAndReload(url, formParas, divId) {
68 84
	var myRequest = new Ajax.Updater(divId, url,
69 85
			{	method: 'post',
70
				parameters: Form.serialize(formObj),
86
				parameters: formParas,
71 87
				onSuccess: function(reponse) {
72 88
					window.location.reload();
73 89
				}

Also available in: Unified diff