summaryrefslogtreecommitdiff
path: root/alarm/node_modules/node-forge/tests/form.js
blob: abfbab02c2f9d69968fbec6af1913cc925b7b2de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
 * Forge Form Tests
 *
 * @author Dave Longley
 *
 * Copyright (c) 2011 Digital Bazaar, Inc. All rights reserved.
 */
(function($) {
$(document).ready(function()
{
   // logging category
   var cat = 'forge.tests.form';
   
   // local alias
   var forge = window.forge;
   
   $('form.ajax').each(function(i, form)
   {
      $(form).submit(function()
      {
         try
         {
            var f = forge.form.serialize($(this));
            forge.log.debug(cat, 'result:', JSON.stringify(f));
            $('#result').html(JSON.stringify(f));
            
            /* dictionary test
            var f = forge.form.serialize($(this), '.', {'username':'user'});
            forge.log.debug(cat, 'result:', JSON.stringify(f));
            */
         }
         catch(e)
         {
            console.log('exception', e.stack);
         }
         return false;
      });
   });
});
})(jQuery);