How to call JS functions

I’m implementing an app to control time of productions. So, i have a very good timer clock with javascript code. basically i put onscriptinit my javascript code in a global variable, then assign the global variable to a field onload event.

is working nice, but I want to execute some queries when the timers are starting, stopped, etc. the problem is that when i try to call the php method in javascript button nothing happen, o when I try to call the javascript function on php button the message is that my javascript function is not defined. somebody has any idea to make this work?

clock.png

I moved to a new thread, don’t necropost, please.

About your question. You can’t use JS code on PHP functions, or PHP functions on JS functions. PHP is server side while JS is client side.
If you want to call a PHP function from your JS timer, you can do an Ajax call or redirects. What you can do is create a blank app working as a “service” waiting for Ajax communications. Then, from your clock, fires ajax call to this blank app telling what to do.

I hope I explained.

Yes, thanks, I’m just understanding this. I solve the problem
making a text input field and defined as label, then onload :

{start}=’<a id=“id_sc_field_start” class=“scButton_default” style=“vertical-align: middle; display:inline-block;”>Start</a>’;

then in “ajax events” start_onClick event:

$javascript_function = ‘myStartjsFunction’; // Javascript function name
sc_ajax_javascript($javascript_function);

myphpstartfunction(); //this function (php method) insert info into db

But now, I want to catch js timer hour, mins or sec values when stop the clock, in order to insert into db and get again when resume.

Can somebody give me some ideas, because even in Internet there no php/js apps examples.

Any idea is welcome. thanks in advance.

clock.png