JavaScript functions for encapsulating form data

Source: Internet
Author: User

invocation Example
1     //encapsulating regfee JSON objects2         varRegfee =NewMap ();3         //get form Control Data4         varRegpayform = $ (' #regPayForm '). Serializearray ();5$.each (Regpayform,function() {6Regfee.put ( This. Name, This. value);7         });8         //Total Cost9         varRegfeefee = $ ("#regFeeFee"). text ();TenRegfee.put ("Fee", Regfeefee); One         //Cash Payments A         varRegfeecashpay = $ ("#regFeeCashPay"). text (); -Regfee.put ("Cashpay", Regfeecashpay); -         //Medicare Payments the         varRegfeemediinsupay = $ ("#regFeeMediInsuPay"). html (); -Regfee.put ("Mediinsupay", Regfeemediinsupay); -  -         //Encapsulation Register JSON object +         varRegister =NewMap (); -         //Manual Number +         varPatino = $ ("#patiNo"). html (); ARegister.put ("Patino", Patino); at         //operator ID -         varOperid = $ ("#operId"). html (); -Register.put ("Operid", Operid); -         //Registered type name -         varRegtypename = $ ("#regTypeName"). html (); -Register.put ("Regtypename", regtypename); in         //Registered Department -         varRegofficename = $ ("#regOfficeName"). html (); toRegister.put ("Regofficename", regofficename); +         //Appointment Time -         varBespeakdate = $ ("#bespeakDate"). html (); theRegister.put ("Bespeakdate", bespeakdate); *         //splicing key value pair parameter $         varparam =NewMap ();Panax Notoginseng         //Configuring the requested controller and method -Param.put ("Controller", "Regfeecontroller"); theParam.put ("Method", "Createregfee"); +Param.put ("Regfee", Json.stringify (Regfee.data)); AParam.put ("register", Json.stringify (Register.data)); the         //Debug Code +         //Console.log ("Param.data:"); -         //Console.log (param.data);


1 //encapsulating form data Methods2 functionMap () {3 This. data = {};4 This. put =function(key, value) {5 This. Data[key] =value;6 };7 8 This. get =function(key) {9 return This. Data[key];Ten }; One A This. remove =function(key) { - This. Data[key] =NULL; - }; the - This. IsEmpty =function() { - return This. Data.length = = 0; - }; + - This. Size =function() { + return This. data.length; A }; at}

JavaScript functions for encapsulating form data

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.