0

I have a program which records the time when user clicks the button I have written the timer script in javascript now i want to include this function inside php how can do this.

Thank you,

Swarna

6
  • output it like you do with html or anything else...? php executes php (server side usually), js is executed by the client (the one "reading" also the html or whatever the server is sending). Commented Jun 23, 2010 at 20:19
  • 1
    As said by you, you can't. You could however call a php script with ajax to store that time. Commented Jun 23, 2010 at 20:26
  • @simon i want to use the result to store it in the database Commented Jun 23, 2010 at 20:42
  • @thisMayhem i don't have any idea about ajax can you tell me how to do that Commented Jun 23, 2010 at 20:43
  • @Shin basically my program is a image slideshow each image pausing for 3 seconds an in that span user has to take a decision by clicking the button..alert message is displayed along with the message i need to store the time taken by user to click the button. Commented Jun 23, 2010 at 20:46

1 Answer 1

2

Use ajax to send the click time details to a php script that will do something with it. ie: log to a database the time of the click.

Sign up to request clarification or add additional context in comments.

2 Comments

Take a look at the jQuery framework it makes ajax calls simple api.jquery.com/jQuery.ajax
I could never explain all of ajax here but follow the advice givin about going the jquery way. Its easy and there are a ton of good examples.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.