Project

General

Profile

1
 /*
2
  *   '$RCSfile$'
3
  *     Purpose: Basic Ajax utilities
4
  *   Copyright: 2009 Regents of the University of California and the
5
  *               National Center for Ecological Analysis and Synthesis
6
  *     Authors: Michael Daigle
7
  *
8
  *    '$Author: daigle $'
9
  *      '$Date: 2008-07-06 21:25:34 -0700 (Sun, 06 Jul 2008) $'
10
  *  '$Revision: 4080 $'
11
  *
12
  * This program is free software; you can redistribute it and/or modify
13
  * it under the terms of the GNU General Public License as published by
14
  * the Free Software Foundation; either version 2 of the License, or
15
  * (at your option) any later version.
16
  *
17
  * This program is distributed in the hope that it will be useful,
18
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
  * GNU General Public License for more details.
21
  *
22
  * You should have received a copy of the GNU General Public License
23
  * along with this program; if not, write to the Free Software
24
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25
  */
26
 
27
/* submits a form via ajax and inserts the results into the given div  
28
 *  Params:
29
 *    url - url to hit
30
 *    formId - id of the form to submit
31
 *    divId - the name of the div where the results should be put
32
 */  
33
function submitFormIntoDiv(url, formId, divId) {
34
	//alert('Sending form: ' + formId + " to url: " + url);
35
	var formObj = document.getElementById(formId);
36

    
37
	var myRequest = new Ajax.Updater(divId, url,
38
		{	method: 'post',
39
			parameters: Form.serialize(formObj),
40
		});
41
}
42

    
43
/* submits a url via ajax and inserts the results into the given div  
44
 *  Params:
45
 *    url - url to hit
46
 *    divId - the name of the div where the results should be put
47
 */  
48
function submitUrlIntoDiv(url, divId) {
49
	//alert('Sending url: ' + url);
50

    
51
	var myRequest = new Ajax.Updater(divId, url,
52
		{	method: 'get'
53
		});
54
}
55
  
(3-3/31)