timer.jquery | jQuery Timer: Start/Stop/Resume/Remove pretty timer inside any HTML element | Frontend Framework library
kandi X-RAY | timer.jquery Summary
kandi X-RAY | timer.jquery Summary
jQuery Timer: Start/Stop/Resume/Remove pretty timer inside any HTML element.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of timer.jquery
timer.jquery Key Features
timer.jquery Examples and Code Snippets
Community Discussions
Trending Discussions on timer.jquery
QUESTION
I'm using this jquery timer to collect time spent while it is running.
https://github.com/walmik/timer.jquery http://jquerytimer.com/
In a prior Stack Overflow post we were able to Post to another page the current accumulated time using jQuery Ajax (jQuery.timer how to get current value in php?). Many thinks to @Dakis
It seems our current solution is trying to save on any Stop and Restart of the Timer. It only needs to do a Save to DB routine IF the “Save Time and Notes” button is selected.
I’ve been researching jQuery Ajax and understand that a key/value pair is needed to be sent to the server/receiving page. I understand the first value identifies the target from which to get the "key", but I could not get a clear understanding of proper formatting for the second “value”. 'task': $('.ta_tasks').data('task’) does not seem to be passing the value as expected.
I’ve added a TextArea with an ID of “ta_tasks” and appended the current working AJAX with:
...ANSWER
Answered 2018-Mar-19 at 16:50check your ajax request data that you re sending and the one you are getting in your saveTime.php, you are sending 'task' and receiving 'ta_task' in saveTime.php
QUESTION
I'm using this jquery timer to collect time spent while it is running.
https://github.com/walmik/timer.jquery
How to I get the current value into a php variable?
I'd like to have a Button that when clicked saves the current value in the input field.
Problem is that when I wrap the input in a form and expect to use a $_POST['fieldID'] to collect the value it disables the jqueryTimer.
I can pull the input field out of the form but what is the best means to collect the current value presented with jQuery? Write a script addition that populates a hidden field with the current value from jQueryTimer?
It would be ideal if the value available to php could also be updated if the Pause and restart is invoked.
EDIT TO SHOW CODE:
...ANSWER
Answered 2018-Mar-16 at 23:06Here is my proposal. It's indeed based on performing an ajax request. A form is, of course, not needed in this case. As already commented, by submitting a form, all informations related to the timer in the current page would be lost, because the submit would refresh the whole page where the timer resides, or would even redirect to another page - if so demanded.
You can run my code as it is, but you need to change the db connection credentials and the db table related infos in the INSERT sql statement.
The timer resides in index.php. The server-side saving operation is performed in saveTime.php - I used the PDO extension for it. The database connection is created in connection.php.
On the client-side, the saving operation - saveTime() - is started by clicking the .save-timer-btn button, or the .pause-timer-btn button. But you can call saveTime() on the events of your choice.
If the posted timer value is not defined, the PHP code sends a response header, which triggers the error function of the ajax request. The error function will then display a bootstrap alert of type danger. The same applies if the passed timer state is not recognised by PHP. If the saving operation succeeds, a success alert will be displayed.
Note: My codes don't rely on your codes, but they are just slightly different. This is because I used the last version (0.7.1) of the timer and the code used in the demo from jquerytimer.com. I suggest you to pay attention to each code line. Sorry :-) I also used the version 3.3.7 of Bootstrap.
Note: For proper error reporting/handling you could read this and this articles, since I didn't implement it in my PHP code.
index.phpCommunity Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install timer.jquery
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page