set_charging.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. <?php
  2. ini_set('error_reporting', E_ALL | E_STRICT);
  3. $tag_header = 'set';
  4. include 'head.php';
  5. $obj = json_decode(trim($output[1]),true);//var_dump($obj);
  6. $ChargingInfo3=$obj['ChargingInfo3'];//var_dump($ChargingInfo3);
  7. $idx=0;
  8. ?>
  9. <div class="envor-content">
  10. <!--
  11. Page Title start
  12. //-->
  13. <section class="envor-page-title-1" data-stellar-background-ratio="0.5">
  14. <div class="container">
  15. <div class="row">
  16. <div class="col-lg-9 col-md-9 col-sm-9">
  17. <h1><?php echo $lang->showWord("charging"); ?></h1>
  18. </div>
  19. </div>
  20. </div>
  21. <!--
  22. Page Title end
  23. //-->
  24. </section>
  25. <!--
  26. Main Content start
  27. //-->
  28. <section class="envor-section">
  29. <div class="container">
  30. <div class="row">
  31. <div class="col-lg-12">
  32. <div class="envor-sorting" id="faq-sorting">
  33. <div class="envor-toggle">
  34. <!--Charging relevant parameters-->
  35. <article class="envor-sorting-item css">
  36. <header><?php echo $lang->showWord("charging_relevant_parameters"); ?><i class="fa fa-plus"></i></header>
  37. <section>
  38. <div class="form-group" style="display:<?php echo $am111;?>">
  39. <label>MaxChargingEnergy</label>
  40. <input type="text" name="MaxChargingEnergy" id="MaxChargingEnergy" class="form-control" value="<?php echo $ob['MaxChargingEnergy'];?>">
  41. </div>
  42. <div class="form-group" style="display:<?php echo $am001;?>">
  43. <label>MaxChargingPower</label>
  44. <input type="text" name="MaxChargingPower" id="MaxChargingPower" class="form-control" value="<?php echo $obj['MaxChargingPower'];?>">
  45. </div>
  46. <div class="form-group" style="display:<?php echo $am111;?>">
  47. <label>MaxChargingCurrent</label>
  48. <input type="text" name="MaxChargingCurrent" id="MaxChargingCurrent" class="form-control" value="<?php echo $obj['MaxChargingCurrent'];?>">
  49. </div>
  50. <div class="form-group" style="display:<?php echo $am111;?>">
  51. <label>MaxChargingDuration</label>
  52. <input type="text" name="MaxChargingDuration" id="MaxChargingDuration" class="form-control" value="<?php echo $obj['MaxChargingDuration'];?>">
  53. </div>
  54. <div class="form-group" style="display:<?php echo $am001;?>">
  55. <label>PhaseLossPolicy</label>
  56. <select class="form-control" id="PhaseLossPolicy" name="PhaseLossPolicy">
  57. <option value="0" <?php echo $obj['PhaseLossPolicy']==0?"selected":""?>>charging</option>
  58. <option value="1" <?php echo $obj['PhaseLossPolicy']==1?"selected":""?>>stop charging</option>
  59. </select>
  60. </div>
  61. <div class="form-group" style="display:<?php echo $am111;?>">
  62. <label>LocalWhiteCard0</label>
  63. <input type="text" name="LocalWhiteCard0" id="LocalWhiteCard0" class="form-control" value="<?php echo $obj['LocalWhiteCard'][0];?>">
  64. </div>
  65. <div class="form-group" style="display:<?php echo $am111;?>">
  66. <label>LocalWhiteCard1</label>
  67. <input type="text" name="LocalWhiteCard1" id="LocalWhiteCard1" class="form-control" value="<?php echo $obj['LocalWhiteCard'][1];?>">
  68. </div>
  69. <div class="form-group" style="display:<?php echo $am111;?>">
  70. <label>LocalWhiteCard2</label>
  71. <input type="text" name="LocalWhiteCard2" id="LocalWhiteCard2" class="form-control" value="<?php echo $obj['LocalWhiteCard'][2];?>">
  72. </div>
  73. <div class="form-group" style="display:<?php echo $am111;?>">
  74. <label>LocalWhiteCard3</label>
  75. <input type="text" name="LocalWhiteCard3" id="LocalWhiteCard3" class="form-control" value="<?php echo $obj['LocalWhiteCard'][3];?>">
  76. </div>
  77. <div class="form-group" style="display:<?php echo $am111;?>">
  78. <label>LocalWhiteCard4</label>
  79. <input type="text" name="LocalWhiteCard4" id="LocalWhiteCard4" class="form-control" value="<?php echo $obj['LocalWhiteCard'][4];?>">
  80. </div>
  81. <div class="form-group" style="display:<?php echo $am111;?>">
  82. <label>LocalWhiteCard5</label>
  83. <input type="text" name="LocalWhiteCard5" id="LocalWhiteCard5" class="form-control" value="<?php echo $obj['LocalWhiteCard'][5];?>">
  84. </div>
  85. <div class="form-group" style="display:<?php echo $am111;?>">
  86. <label>LocalWhiteCard6</label>
  87. <input type="text" name="LocalWhiteCard6" id="LocalWhiteCard6" class="form-control" value="<?php echo $obj['LocalWhiteCard'][6];?>">
  88. </div>
  89. <div class="form-group" style="display:<?php echo $am111;?>">
  90. <label>LocalWhiteCard7</label>
  91. <input type="text" name="LocalWhiteCard7" id="LocalWhiteCard7" class="form-control" value="<?php echo $obj['LocalWhiteCard'][7];?>">
  92. </div>
  93. <div class="form-group" style="display:<?php echo $am111;?>">
  94. <label>LocalWhiteCard8</label>
  95. <input type="text" name="LocalWhiteCard8" id="LocalWhiteCard8" class="form-control" value="<?php echo $obj['LocalWhiteCard'][8];?>">
  96. </div>
  97. <div class="form-group" style="display:<?php echo $am111;?>">
  98. <label>LocalWhiteCard9</label>
  99. <input type="text" name="LocalWhiteCard9" id="LocalWhiteCard9" class="form-control" value="<?php echo $obj['LocalWhiteCard'][9];?>">
  100. </div>
  101. <div class="form-group" style="display:<?php echo $am111;?>">
  102. <label>CcsAuthentication</label>
  103. <select class="form-control" id="CcsAuthentication" name="CcsAuthentication">
  104. <option value="0" <?php echo $obj['CcsAuthentication']==0?"selected":""?>>EIM</option>
  105. <option value="1" <?php echo $obj['CcsAuthentication']==1?"selected":""?>>EIM&PnC mixed</option>
  106. </select>
  107. </div>
  108. <div class="form-group" style="display:<?php echo $am111;?>">
  109. <label>AcCcsChargingModel</label>
  110. <select class="form-control" id="AcCcsChargingModel" name="AcCcsChargingModel">
  111. <option value="0" <?php echo $obj['AcCcsChargingModel']==0?"selected":""?>>BC (PWM) only</option>
  112. <option value="1" <?php echo $obj['AcCcsChargingModel']==0?"selected":""?>>BC&PLC mixed</option>
  113. </select>
  114. </div>
  115. </section>
  116. </article>
  117. <?php if($obj['ChargingInfo1']){ $idx++;?>
  118. <!--Charging Information-->
  119. <article class="envor-sorting-item css">
  120. <header><?php echo $lang->showWord("charging_information").$idx; ?><i class="fa fa-plus"></i></header>
  121. <section>
  122. <div class="form-group" style="display:<?php echo $am111;?>">
  123. <label>User Id</label>
  124. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['UserId'];?>">
  125. <input type="hidden" name="UserId" id="UserId" value="<?php echo $obj->{'UserId'};?>">
  126. </div>
  127. <div class="form-group" style="display:<?php echo $am001;?>">
  128. <label>PresentChargingVoltage</label>
  129. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['PresentChargingVoltage'];?>">
  130. <input type="hidden" name="PresentChargingVoltage" id="PresentChargingVoltage" value="<?php echo $obj->{'PresentChargingVoltage'};?>">
  131. </div>
  132. <div class="form-group" style="display:<?php echo $am111;?>">
  133. <label>PresentChargingCurrent</label>
  134. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['PresentChargingCurrent'];?>">
  135. <input type="hidden" name="PresentChargingCurrent" id="PresentChargingCurrent" value="<?php echo $obj->{'PresentChargingCurrent'};?>">
  136. </div>
  137. <div class="form-group" style="display:<?php echo $am111;?>">
  138. <label>PresentChargingPower</label>
  139. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['PresentChargingPower'];?>">
  140. <input type="hidden" name="PresentChargingPower" id="PresentChargingPower" value="<?php echo $obj->{'PresentChargingPower'};?>">
  141. </div>
  142. <div class="form-group" style="display:<?php echo $am111;?>">
  143. <label>PresentChargedEnergy</label>
  144. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['PresentChargedEnergy'];?>">
  145. <input type="hidden" name="PresentChargedEnergy" id="PresentChargedEnergy" value="<?php echo $obj->{'PresentChargedEnergy'};?>">
  146. </div>
  147. <div class="form-group" style="display:<?php echo $am111;?>">
  148. <label>PresentChargedDuration</label>
  149. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['PresentChargedDuration'];?>">
  150. <input type="hidden" name="PresentChargedDuration" id="PresentChargedDuration" value="<?php echo $obj->{'PresentChargedDuration'};?>">
  151. </div>
  152. <div class="form-group" style="display:<?php echo $am001;?>">
  153. <label>RemainChargingDuration</label>
  154. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['RemainChargingDuration'];?>">
  155. <input type="hidden" name="RemainChargingDuration" id="RemainChargingDuration" value="<?php echo $obj->{'RemainChargingDuration'};?>">
  156. </div>
  157. <div class="form-group" style="display:<?php echo $am001;?>">
  158. <label>EvBatteryMaxVoltage</label>
  159. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['EvBatteryMaxVoltage'];?>">
  160. <input type="hidden" name="EvBatteryMaxVoltage" id="EvBatteryMaxVoltage" value="<?php echo $obj->{'EvBatteryMaxVoltage'};?>">
  161. </div>
  162. <div class="form-group" style="display:<?php echo $am001;?>">
  163. <label>EvBatterytargetVoltage</label>
  164. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['EvBatterytargetVoltage'];?>">
  165. <input type="hidden" name="EvBatterytargetVoltage" id="EvBatterytargetVoltage" value="<?php echo $obj->{'EvBatterytargetVoltage'};?>">
  166. </div>
  167. <div class="form-group" style="display:<?php echo $am001;?>">
  168. <label>EvBatterySoc</label>
  169. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['EvBatterySoc'];?>">
  170. <input type="hidden" name="EvBatterySoc" id="EvBatterySoc" value="<?php echo $obj->{'EvBatterySoc'};?>">
  171. </div>
  172. </section>
  173. </article>
  174. <?php }?>
  175. <?php if($obj['ChargingInfo2']){ $idx++;?>
  176. <!--Charging Information-->
  177. <article class="envor-sorting-item css">
  178. <header><?php echo $lang->showWord("charging_information").$idx; ?><i class="fa fa-plus"></i></header>
  179. <section>
  180. <div class="form-group" style="display:<?php echo $am111;?>">
  181. <label>User Id</label>
  182. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['UserId'];?>">
  183. <input type="hidden" name="UserId" id="UserId" value="<?php echo $obj->{'UserId'};?>">
  184. </div>
  185. <div class="form-group" style="display:<?php echo $am001;?>">
  186. <label>PresentChargingVoltage</label>
  187. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo2']['PresentChargingVoltage'];?>">
  188. <input type="hidden" name="PresentChargingVoltage" id="PresentChargingVoltage" value="<?php echo $obj->{'PresentChargingVoltage'};?>">
  189. </div>
  190. <div class="form-group" style="display:<?php echo $am111;?>">
  191. <label>PresentChargingCurrent</label>
  192. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo2']['PresentChargingCurrent'];?>">
  193. <input type="hidden" name="PresentChargingCurrent" id="PresentChargingCurrent" value="<?php echo $obj->{'PresentChargingCurrent'};?>">
  194. </div>
  195. <div class="form-group" style="display:<?php echo $am111;?>">
  196. <label>PresentChargingPower</label>
  197. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo2']['PresentChargingPower'];?>">
  198. <input type="hidden" name="PresentChargingPower" id="PresentChargingPower" value="<?php echo $obj->{'PresentChargingPower'};?>">
  199. </div>
  200. <div class="form-group" style="display:<?php echo $am111;?>">
  201. <label>PresentChargedEnergy</label>
  202. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo2']['PresentChargedEnergy'];?>">
  203. <input type="hidden" name="PresentChargedEnergy" id="PresentChargedEnergy" value="<?php echo $obj->{'PresentChargedEnergy'};?>">
  204. </div>
  205. <div class="form-group" style="display:<?php echo $am111;?>">
  206. <label>PresentChargedDuration</label>
  207. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo2']['PresentChargedDuration'];?>">
  208. <input type="hidden" name="PresentChargedDuration" id="PresentChargedDuration" value="<?php echo $obj->{'PresentChargedDuration'};?>">
  209. </div>
  210. <div class="form-group" style="display:<?php echo $am001;?>">
  211. <label>RemainChargingDuration</label>
  212. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo2']['RemainChargingDuration'];?>">
  213. <input type="hidden" name="RemainChargingDuration" id="RemainChargingDuration" value="<?php echo $obj->{'RemainChargingDuration'};?>">
  214. </div>
  215. <div class="form-group" style="display:<?php echo $am001;?>">
  216. <label>EvBatteryMaxVoltage</label>
  217. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo2']['EvBatteryMaxVoltage'];?>">
  218. <input type="hidden" name="EvBatteryMaxVoltage" id="EvBatteryMaxVoltage" value="<?php echo $obj->{'EvBatteryMaxVoltage'};?>">
  219. </div>
  220. <div class="form-group" style="display:<?php echo $am001;?>">
  221. <label>EvBatterytargetVoltage</label>
  222. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo2']['EvBatterytargetVoltage'];?>">
  223. <input type="hidden" name="EvBatterytargetVoltage" id="EvBatterytargetVoltage" value="<?php echo $obj->{'EvBatterytargetVoltage'};?>">
  224. </div>
  225. <div class="form-group" style="display:<?php echo $am001;?>">
  226. <label>EvBatterySoc</label>
  227. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo2']['EvBatterySoc'];?>">
  228. <input type="hidden" name="EvBatterySoc" id="EvBatterySoc" value="<?php echo $obj->{'EvBatterySoc'};?>">
  229. </div>
  230. </section>
  231. </article>
  232. <?php }?>
  233. <?php if($obj['ChargingInfo3']){ $idx++;?>
  234. <!--Charging Information-->
  235. <article class="envor-sorting-item css">
  236. <header><?php echo $lang->showWord("charging_information").$idx; ?><i class="fa fa-plus"></i></header>
  237. <section>
  238. <div class="form-group" style="display:<?php echo $am111;?>">
  239. <label>User Id</label>
  240. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['UserId'];?>">
  241. <input type="hidden" name="UserId" id="UserId" value="<?php echo $obj->{'UserId'};?>">
  242. </div>
  243. <div class="form-group" style="display:<?php echo $am001;?>">
  244. <label>PresentChargingVoltage</label>
  245. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo3']['PresentChargingVoltage'];?>">
  246. <input type="hidden" name="PresentChargingVoltage" id="PresentChargingVoltage" value="<?php echo $obj->{'PresentChargingVoltage'};?>">
  247. </div>
  248. <div class="form-group" style="display:<?php echo $am111;?>">
  249. <label>PresentChargingCurrent</label>
  250. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo3']['PresentChargingCurrent'];?>">
  251. <input type="hidden" name="PresentChargingCurrent" id="PresentChargingCurrent" value="<?php echo $obj->{'PresentChargingCurrent'};?>">
  252. </div>
  253. <div class="form-group" style="display:<?php echo $am111;?>">
  254. <label>PresentChargingPower</label>
  255. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo3']['PresentChargingPower'];?>">
  256. <input type="hidden" name="PresentChargingPower" id="PresentChargingPower" value="<?php echo $obj->{'PresentChargingPower'};?>">
  257. </div>
  258. <div class="form-group" style="display:<?php echo $am111;?>">
  259. <label>PresentChargedEnergy</label>
  260. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo3']['PresentChargedEnergy'];?>">
  261. <input type="hidden" name="PresentChargedEnergy" id="PresentChargedEnergy" value="<?php echo $obj->{'PresentChargedEnergy'};?>">
  262. </div>
  263. <div class="form-group" style="display:<?php echo $am111;?>">
  264. <label>PresentChargedDuration</label>
  265. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo3']['PresentChargedDuration'];?>">
  266. <input type="hidden" name="PresentChargedDuration" id="PresentChargedDuration" value="<?php echo $obj->{'PresentChargedDuration'};?>">
  267. </div>
  268. <div class="form-group" style="display:<?php echo $am001;?>">
  269. <label>RemainChargingDuration</label>
  270. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo3']['RemainChargingDuration'];?>">
  271. <input type="hidden" name="RemainChargingDuration" id="RemainChargingDuration" value="<?php echo $obj->{'RemainChargingDuration'};?>">
  272. </div>
  273. <div class="form-group" style="display:<?php echo $am001;?>">
  274. <label>EvBatteryMaxVoltage</label>
  275. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo3']['EvBatteryMaxVoltage'];?>">
  276. <input type="hidden" name="EvBatteryMaxVoltage" id="EvBatteryMaxVoltage" value="<?php echo $obj->{'EvBatteryMaxVoltage'};?>">
  277. </div>
  278. <div class="form-group" style="display:<?php echo $am001;?>">
  279. <label>EvBatterytargetVoltage</label>
  280. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo3']['EvBatterytargetVoltage'];?>">
  281. <input type="hidden" name="EvBatterytargetVoltage" id="EvBatterytargetVoltage" value="<?php echo $obj->{'EvBatterytargetVoltage'};?>">
  282. </div>
  283. <div class="form-group" style="display:<?php echo $am001;?>">
  284. <label>EvBatterySoc</label>
  285. <input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo3']['EvBatterySoc'];?>">
  286. <input type="hidden" name="EvBatterySoc" id="EvBatterySoc" value="<?php echo $obj->{'EvBatterySoc'};?>">
  287. </div>
  288. </section>
  289. </article>
  290. <?php }?>
  291. <article class="envor-sorting-item css">
  292. <div align="center"><button id="save"><?php echo $lang->showWord("set")?></button></div>
  293. </article>
  294. </div>
  295. </div>
  296. </div>
  297. </div>
  298. </div>
  299. </section>
  300. </div>
  301. <?php
  302. include 'foot.php';
  303. ?>
  304. <script type="text/JavaScript">
  305. document.getElementById("save").onclick = function() {
  306. if(formCheck())
  307. {
  308. // 發送 Ajax 查詢請求並處理
  309. var request = new XMLHttpRequest();
  310. request.open("POST", "set_charging_action.php");
  311. // POST 參數須使用 send() 發送
  312. var data = "MaxChargingEnergy=" + document.getElementById("MaxChargingEnergy").value +
  313. "&MaxChargingPower=" + document.getElementById("MaxChargingPower").value +
  314. "&MaxChargingCurrent=" + document.getElementById("MaxChargingCurrent").value+
  315. "&MaxChargingDuration=" + document.getElementById("MaxChargingDuration").value+
  316. "&PhaseLossPolicy=" + document.getElementById("PhaseLossPolicy").value+
  317. "&LocalWhiteCard0=" + document.getElementById("LocalWhiteCard0").value+
  318. "&LocalWhiteCard1=" + document.getElementById("LocalWhiteCard1").value+
  319. "&LocalWhiteCard2=" + document.getElementById("LocalWhiteCard2").value+
  320. "&LocalWhiteCard3=" + document.getElementById("LocalWhiteCard3").value+
  321. "&LocalWhiteCard4=" + document.getElementById("LocalWhiteCard4").value+
  322. "&LocalWhiteCard5=" + document.getElementById("LocalWhiteCard5").value+
  323. "&LocalWhiteCard6=" + document.getElementById("LocalWhiteCard6").value+
  324. "&LocalWhiteCard7=" + document.getElementById("LocalWhiteCard7").value+
  325. "&LocalWhiteCard8=" + document.getElementById("LocalWhiteCard8").value+
  326. "&LocalWhiteCard9=" + document.getElementById("LocalWhiteCard9").value+
  327. "&CcsAuthentication=" + document.getElementById("CcsAuthentication").value+
  328. "&AcCcsChargingModel=" + document.getElementById("AcCcsChargingModel").value+
  329. "&UserId=" + document.getElementById("UserId").value+
  330. "&PresentChargingVoltage=" + document.getElementById("PresentChargingVoltage").value+
  331. "&PresentChargingCurrent=" + document.getElementById("PresentChargingCurrent").value+
  332. "&PresentChargingPower=" + document.getElementById("PresentChargingPower").value+
  333. "&PresentChargedEnergy=" + document.getElementById("PresentChargedEnergy").value+
  334. "&PresentChargedDuration=" + document.getElementById("PresentChargedDuration").value+
  335. "&RemainChargingDuration=" + document.getElementById("RemainChargingDuration").value+
  336. "&EvBatteryMaxVoltage=" + document.getElementById("EvBatteryMaxVoltage").value+
  337. "&EvBatterytargetVoltage=" + document.getElementById("EvBatterytargetVoltage").value+
  338. "&EvBatterySoc=" + document.getElementById("EvBatterySoc").value;
  339. // POST 請求必須設置表頭在 open() 下面,send() 上面
  340. request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  341. request.send(data);
  342. request.onreadystatechange = function() {
  343. // 伺服器請求完成
  344. if (request.readyState == 4) {
  345. // 伺服器回應成功
  346. if (request.status == 200) {
  347. alert("<?php echo $lang->showWord("done")?>");
  348. //location.reload();
  349. // getInfo();
  350. } else {
  351. alert("發生錯誤" + request.status);
  352. }
  353. }
  354. }
  355. }
  356. }
  357. function formCheck()
  358. {
  359. var MaxChargingEnergy = document.getElementById("MaxChargingEnergy").value;
  360. var MaxChargingPower = document.getElementById("MaxChargingPower").value;
  361. var MaxChargingCurrent = document.getElementById("MaxChargingCurrent").value;
  362. var MaxChargingDuration = document.getElementById("MaxChargingDuration").value;
  363. if(MaxChargingEnergy >65535)
  364. {
  365. alert("MaxChargingEnergy must <= 65535!");
  366. document.getElementById("MaxChargingEnergy").focus();
  367. return false;
  368. }
  369. if(MaxChargingPower >65535)
  370. {
  371. alert("MaxChargingPower must <= 65535!");
  372. document.getElementById("MaxChargingPower").focus();
  373. return false;
  374. }
  375. if(MaxChargingCurrent >65535)
  376. {
  377. alert("MaxChargingCurrent must <= 65535!");
  378. document.getElementById("MaxChargingCurrent").focus();
  379. return false;
  380. }
  381. if(MaxChargingDuration >65535)
  382. {
  383. alert("MaxChargingDuration must <= 65535!");
  384. document.getElementById("MaxChargingDuration").focus();
  385. return false;
  386. }
  387. // if(serverAddr.length <=0)
  388. // {
  389. // alert("Please check remote server address!");
  390. // serverAddr.focus();
  391. // return false;
  392. // }
  393. // if((serverPort.value >65535) || (serverPort.value<0))
  394. // {
  395. // alert("Please check remote server port, it's must <= 65535!");
  396. // serverPort.focus();
  397. // return false;
  398. // }
  399. // if( confirm("Are you sure to update ID to " + ChargerID + "?") == 1 )
  400. // return true;
  401. // else
  402. // return false;
  403. return true;
  404. }
  405. function isNumberKey(evt)
  406. {
  407. var charCode = (evt.which) ? evt.which : event.keyCode
  408. if (charCode > 31 && (charCode < 48 || charCode > 57) && (charCode != 46))
  409. return false;
  410. return true;
  411. }
  412. </script>
  413. </html>