Home get time from clockpicker and then write the time to mysql
Reply: 1

get time from clockpicker and then write the time to mysql

Philipp Nesterov
1#
Philipp Nesterov Published in 2018-01-12 21:09:19Z

I use https://github.com/weareoutman/clockpicker for setting time.

$('.clockpicker-with-callbacks').clockpicker({
    donetext: 'Done',
    afterDone: function() {
      console.log(this.value);
    }
  })
  .find('input').change(function() {
    console.log(this.value);
  });
if (/Mobile/.test(navigator.userAgent)) {
  $('input').prop('readOnly', true);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class='clearfix'>
  <div class='input-group clockpicker-with-callbacks'>

    <input type='text' class='form-control' value='10:10'>

    <span class='input-group-addon'><span class='glyphicon glyphicon-time'>
    
    </span></span>
  </div>
</div>

So. I need some how write the input time to mysql data base. And it must be done in afterDone: function()

Please, help!

hexYeah
2#
hexYeah Reply to 2018-01-12 22:33:19Z

You could make an ajax call to another php script that would store the result in your database

 $.post( "path/file.php", { 
            var_time: this.value
        }).done(function( data, status ) {

         console.log('data: '+data+' status: '+status);

         if(data == 'success' && status == 'success'){      

         }else{

         }
      }
);

The console.log('data: '+data+' status: '+status); will display the output of your other script, don't forget to sanitize the user input ;)

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.341548 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO