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