Mercurial > rlmcintyre
comparison BoosterPack/scripts/.svn/text-base/pjx_objects_2_url.pl.svn-base @ 0:0d795f02a8bb tip
initial committ. what was I thinking?
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 27 Sep 2010 16:57:26 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:0d795f02a8bb |
---|---|
1 #!C:/strawberry/perl/bin/perl.exe | |
2 | |
3 # this is an example script of how you would use coderefs to define | |
4 # your CGI::Ajax functions. | |
5 # | |
6 # NB The CGI::Ajax object must come AFTER the coderefs are declared. | |
7 | |
8 use strict; | |
9 use CGI::Ajax; | |
10 use CGI; | |
11 | |
12 my $q = new CGI; | |
13 | |
14 my $exported_fx = sub { | |
15 my $value_a = shift; | |
16 my $iq = new CGI; | |
17 my $a = $q->param('a'); | |
18 my $b = $q->param('b'); | |
19 my $test = $q->param('test'); | |
20 return( | |
21 'entered value was: ' . $value_a . | |
22 '<br/>a was: ' . $a . "..." . | |
23 '<br/>b was: ' . $b . "..." . | |
24 '<br/>test was: ' . $test . "..." | |
25 ); | |
26 }; | |
27 | |
28 | |
29 my $Show_Form = sub { | |
30 my $html = ""; | |
31 $html .= <<EOT; | |
32 <HTML> | |
33 <HEAD><title>CGI::Ajax Example</title> | |
34 </HEAD> | |
35 <BODY> | |
36 <form> | |
37 this javascript object is sent in as an argument: | |
38 {'a':123,'b':345,'test':'123 Evergreen Terrace'} | |
39 <br/><br/> | |
40 Enter something else: | |
41 <input type="text" name="val1" size="6" onkeyup="myfunc( | |
42 ['val1',{'a':123,'b':345,'test':'123 Evergreen Terrace'} ], 'resultdiv' ); return true;"><br> | |
43 | |
44 <hr> | |
45 <DIV id="resultdiv" style="border: 1px solid black; width: 440px; height: 80px; overflow: auto"> | |
46 </div> | |
47 </form> | |
48 </BODY> | |
49 </HTML> | |
50 EOT | |
51 | |
52 return $html; | |
53 }; | |
54 | |
55 my $pjx = CGI::Ajax->new( 'myfunc' => $exported_fx); | |
56 $pjx->JSDEBUG(2); | |
57 $pjx->DEBUG(2); | |
58 print $pjx->build_html($q,$Show_Form); # this outputs the html for the page | |
59 |