You can only get the value of the time but not the input after committing
Php
Public Function _feedback () {$post = $this->input->post (NULL, TRUE); $ac =$_request[' ac '];if ($ac = = ' Activityuser_ Sn ') {$post [' addtime '] = time (); $post [' txt_name '] = $tel; $this->asdasd->insert ($post); $prize _arr =array (' Success ' = ' + ' true '); This is the Echo json_encode ($prize _arr) that completed the order after submission;}}
Html
Js
$ (function () {Window.requestanimframe = (function () {return Window.requestanimationframe | | Window.webkitrequestanimationframe | | Window.mozrequestanimationframe | | Window.orequestanimationframe | | Window.msrequestanimationframe | | Function (callback) {Window.settimeout (callback, 1000/60)}) (), var totaldeg = * 3 + 0;var steps = [];var lostdeg = [3 6, 186, 156, 216, 276, 306, 336];var prizedeg = [6, 126, 246]; var lostdeg = [6, 36, 66, 96, 126,156, 186, 216,246, 276, 306, 156, 186, 216, 276, 306, 336];//var Prizedeg] , 336];var Prize, Sncode;var count = 0;var now = 0;var A = 0.01;var Strmsg;var outter, inner, timer, running = false;funct Ion Countsteps () {var t = math.sqrt (2 * totaldeg/a), var v = a * t;for (var i = 0; i < T; i++) {Steps.push ((2 * v * I -A * I * i)/2)}steps.push (totaldeg)}function step () {outter.style.webkitTransform = ' rotate (' + steps[now++] + ' deg) '; o Utter.style.MozTransform = ' rotate (' + steps[now++] + ' deg) '; if (now < steps.length){Requestanimframe (STEP)} or else {running = false;settimeout (function () {if (prize! = NULL) {$ ("#sncode"). Text (sncode); var Type = "", if (prize = = 1) {type = "one"} else if (prize = = 5) {type = "two"} else if (prize = = 9) {type = "three"}//alert (prize); $ ("#prizetype"). Text (type); $ ("#result"). Slidetoggle ($); $ ("#outercont"). Slideup (+)} else {//alert (strmsg); Alert ("Thank you for your participation, next time")}},200)}}function Start (deg) {deg = deg | | lostdeg[parseint (LOSTDEG.LENGTH * Math.random ())]; Running = true;clearinterval (timer); totaldeg = 5 + deg;steps = [];now = 0;countsteps (); Requestanimframe (step)}window . Start = Start;outter = document.getElementById (' outer '); inner = document.getElementById (' inner '); i = 10;$ ("#inner"). Click (function () {if (running) return;if (Count >= 2) {alert ("Already 2 times.") Return}if (prize! = null) {alert ("no longer participates"); Return}$.ajax ({url: "http://127.0.0.1/index.php", DataType: "JSON", data : {token: "O7mb9ji5fqrse0zovamu7slnrymi", AC: "Activityuser", Tid: "5", T:math.random ()},beforesend:functioN () {running = True;timer = SetInterval (function () {i + = 5;outter.style.webkittransform = ' rotate (' + i + ' deg) '; outter.st Yle. Moztransform = ' rotate (' + i + ' deg) '},1)},success:function (data) {if (Data.error = = "Invalid") {alert ("has been 3 times. "); count = 3;clearinterval (timer); Return}if (Data.error = =" GETSN ") {alert (' already in, SN code: ' + data.sn '); count = 3; Clearinterval (timer);p Rize = Data.prizetype;sncode = Data.sn;start (prizedeg[data.prizetype-1]); Return}if ( data.success) {prize = Data.prizetype;sncode = Data.sn;//start (Prizedeg[data.prizetype-1]) Start (data.angle)}//if ( Data.error) {else{prize = Null;start ()}running = False;count++},error:function () {prize = Null;start (); running = False;c ount++},timeout:4000})}); $ ("#save-btn"). Bind ("click", Function () {var btn = $ (this); var tel = $ ("#tel"). Val (); if (tel = = ') {alert ("Please enter mobile number"), Return}var Regu =/^[1][0-9]{10}$/;var re = new RegExp (Regu), if (!re.test (tel)) {alert ("Please enter the correct phone number Return}var SubmitData = {tid:5,code: $ ("#sncode"). Text (), Tel:Tel,action: "Settel"};$.post (' Http://127.0.0.1/index.php?ac=activityuser_sn ', submitdata,function (data) {if ( data.success) {alert ("Submit success, thank you for your participation"); $ ("#result"). Slideup ($); $ ("#outercont"). Slidetoggle; running = false; return} else {alert ("Commit Failed"), $ ("#result"). Slideup ($); $ ("#outercont"). Slidetoggle (+);}}, "JSON")});
Reply to discussion (solution)
$post [' txt_name '] = $tel;
Where are $tel defined? Is your frame ready to use the variable after you post it directly?
$post = $this->input->post (NULL, TRUE);
What is the value of printing ¥post
$post [' txt_name '] = $tel;
Where are $tel defined? Is your frame ready to use the variable after you post it directly?
$post = $this->input->post (NULL, TRUE);
What is the value of printing ¥post
Public Function _feedback () {$post = $this->input->post (NULL, TRUE), if (Isset ($post [' btnsubmit '])) {$post [' Addtime '] = time (); $this->message->insert ($post);}}
It used to be, so you can get the value, but you want to change it to the top, and you get the value.
With this
With this
I think it's useless to combine JS.