pass javascript var to php -


this question has answer here:

i have crono app in js need pass var modal in php, have (its embed table)

<table>     <thead>      <th>project</th>     <th>task</th>     <th>tieme</th>     <th><th>           </thead>     <tbody>     <tr>         <td>".$res[0]."</td>         <td>".$res[1]."</td>         <td > <form name='crono' class='large-6'>     <input type='text' name='face' title='cronomet'>     <script type='text/javascript'>     var timecrono;          var hor = 0;         var min = 0;         var seg = 0;         var starttime = new date();         var start = starttime.getseconds();          var startchron = 0;          startcrono();           function startcrono() {            if (startchron == 1) {              if (seg + 1 > 59) {                 min += 1;             }             if (min > 59) {                 min = 0;                 hor += 1;             }             var time = new date();             if (time.getseconds() >= start) {                 seg = time.getseconds() - start;             }             else {                 seg = 60 + (time.getseconds() - start);             }             timecrono = (hor < 10) ? '0' + hor : hor;             timecrono += ((min < 10) ? ':0' : ':') + min;             timecrono += ((seg < 10) ? ':0' : ':') + seg;             document.crono.face.value = timecrono;             settimeout('startcrono()', 1000);              console.log(timecrono);          }       }        function stopchr() {        startchron = 0;      $('#data').text(timecrono);     }           function startchr() {         startchron = 1;         startcrono();     }       </script> </form>   </td>             <td><input type='button' id='btnstart'onclick='startchr();' class='button' value='start'></td>          <td> <a href='#' data-reveal-id='ventana' id='addhrs'><input type='button' id='btnstop'onclick='stopchr();' class='button' value='stop'></a></td>      </tr>     </tbody> </table>"; 

i need 'timecrono' value in format 00:00:00, when press stop button (function stopchr) appear modal info have text of value $('#data').text(timecrono);

but need pass text value of or #data tag <p id='data'></p> , result want like
<p id='data' value='00:00:00'>.

in order pass values javascript server-side code, such php, need send value on network.

ajax 1 of ways that, , jquery makes easy ajax queries.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -